io.TextIOBase

class io.TextIOBase Base class for text streams. 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. It inherits IOBase. There is no public constructor. TextIOBase provides or overrides these data attributes and methods in addition to those from IOBase: encoding The name of the encoding used to decode the stream’s bytes into strings, and to encode strings into bytes. errors The error

io.StringIO.getvalue()

getvalue() Return a str containing the entire contents of the buffer. Newlines are decoded as if by read(), although the stream position is not changed.

io.StringIO

class io.StringIO(initial_value='', newline='\n') An in-memory stream for text I/O. The text buffer is discarded when the close() method is called. The initial value of the buffer can be set by providing initial_value. If newline translation is enabled, newlines will be encoded as if by write(). The stream is positioned at the start of the buffer. The newline argument works like that of TextIOWrapper. The default is to consider only \n characters as ends of lines and to do no newline transla

io.RawIOBase.write()

write(b) Write the given bytes-like object, b, to the underlying raw stream, and return the number of bytes written. This can be less than the length of b in bytes, depending on specifics of the underlying raw stream, and especially if it is in non-blocking mode. None is returned if the raw stream is set not to block and no single byte could be readily written to it. The caller may release or mutate b after this method returns, so the implementation should only access b during the method cal

io.RawIOBase.readinto()

readinto(b) Read bytes into a pre-allocated, writable bytes-like object b, and return the number of bytes read. If the object is in non-blocking mode and no bytes are available, None is returned.

io.RawIOBase.readall()

readall() Read and return all the bytes from the stream until EOF, using multiple calls to the stream if necessary.

io.RawIOBase.read()

read(size=-1) Read up to size bytes from the object and return them. As a convenience, if size is unspecified or -1, readall() is called. Otherwise, only one system call is ever made. Fewer than size bytes may be returned if the operating system call returns fewer than size bytes. If 0 bytes are returned, and size was not 0, this indicates end of file. If the object is in non-blocking mode and no bytes are available, None is returned.

io.RawIOBase

class io.RawIOBase Base class for raw binary I/O. It inherits IOBase. There is no public constructor. Raw binary I/O typically provides low-level access to an underlying OS device or API, and does not try to encapsulate it in high-level primitives (this is left to Buffered I/O and Text I/O, described later in this page). In addition to the attributes and methods from IOBase, RawIOBase provides the following methods: read(size=-1) Read up to size bytes from the object and return them. As a

io.open()

io.open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) This is an alias for the builtin open() function.

io.IOBase.__del__()

__del__() Prepare for object destruction. IOBase provides a default implementation of this method that calls the instance’s close() method.