Markdown Format | JSON API | MCP Server Tool
Help on class _IOBase in _io: _io._IOBase = class _IOBase(builtins.object) | The abstract base class for all I/O classes. | | This class provides dummy implementations for many methods that | derived classes can override selectively; the default implementations | represent a file that cannot be read, written or seeked. | | Even though IOBase does not declare read, readinto, or write because | their signatures will vary, implementations and clients should | consider those methods part of the interface. Also, implementations | may raise UnsupportedOperation when operations they do not support are | called. | | The basic type used for binary data read from or written to a file is | bytes. Other bytes-like objects are accepted as method arguments too. | In some cases (such as readinto), a writable object is required. Text | I/O classes work with str data. | | Note that calling any method (except additional calls to close(), | which are ignored) on a closed stream should raise a ValueError. | | IOBase (and its subclasses) support the iterator protocol, meaning | that an IOBase object can be iterated over yielding the lines in a | stream. | | IOBase also supports the :keyword:`with` statement. In this example, | fp is closed after the suite of the with statement is complete: | | with open('spam.txt', 'r') as fp: | fp.write('Spam and eggs!') | | Methods defined here: | | __del__(...) | | __enter__(...) | | __exit__(...) | | __iter__(self, /) | Implement iter(self). | | __next__(self, /) | Implement next(self). | | close(self, /) | Flush and close the IO object. | | This method has no effect if the file is already closed. | | fileno(self, /) | Returns underlying file descriptor if one exists. | | OSError is raised if the IO object does not use a file descriptor. | | flush(self, /) | Flush write buffers, if applicable. | | This is not implemented for read-only and non-blocking streams. | | isatty(self, /) | Return whether this is an 'interactive' stream. | | Return False if it can't be determined. | | readable(self, /) | Return whether object was opened for reading. | | If False, read() will raise OSError. | | readline(self, size=-1, /) | Read and return a line from the stream. | | If size is specified, at most size bytes will be read. | | The line terminator is always b'\n' for binary files; for text | files, the newlines argument to open can be used to select the line | terminator(s) recognized. | | readlines(self, hint=-1, /) | Return a list of lines from the stream. | | hint can be specified to control the number of lines read: no more | lines will be read if the total size (in bytes/characters) of all | lines so far exceeds hint. | | seek(...) | Change stream position. | | Change the stream position to the given byte offset. The offset is | interpreted relative to the position indicated by whence. Values | for whence are: | | * 0 -- start of stream (the default); offset should be zero or positive | * 1 -- current stream position; offset may be negative | * 2 -- end of stream; offset is usually negative | | Return the new absolute position. | | seekable(self, /) | Return whether object supports random access. | | If False, seek(), tell() and truncate() will raise OSError. | This method may need to do a test seek(). | | tell(self, /) | Return current stream position. | | truncate(...) | Truncate file to size bytes. | | File pointer is left unchanged. Size defaults to the current IO | position as reported by tell(). Returns the new size. | | writable(self, /) | Return whether object was opened for writing. | | If False, write() will raise OSError. | | writelines(self, lines, /) | Write a list of lines to stream. | | Line separators are not added, so it is usual for each of the | lines provided to have a line separator at the end. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | | closed
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 08:52 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)