io.TextIOBase

class io.TextIOBase[source]

Base class for text I/O.

This class provides a character and line based interface to stream I/O. There is no readinto method because Python’s character strings are immutable. There is no public constructor.

Methods

__enter__
__exit__
__format__ default object formatter
__new__((S, ...)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__sizeof__(() -> int) size of object in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().
_checkClosed
_checkReadable
_checkSeekable
_checkWritable
close Flush and close the IO object.
detach Separate the underlying buffer from the TextIOBase and return it.
fileno Returns underlying file descriptor if one exists.
flush Flush write buffers, if applicable.
isatty Return whether this is an ‘interactive’ stream.
read Read at most n characters from stream.
readable Return whether object was opened for reading.
readline Read until newline or EOF.
readlines Return a list of lines from the stream.
seek Change stream position.
seekable Return whether object supports random access.
tell Return current stream position.
truncate Truncate file to size bytes.
writable Return whether object was opened for writing.
write Write string to stream.
writelines

Attributes

closed
encoding Encoding of the text stream.
errors The error setting of the decoder or encoder.
newlines Line endings translated so far.
next