io.BytesIO

class io.BytesIO

Create a buffered I/O implementation using an in-memory bytes buffer, ready for reading and writing.

Methods

__enter__
__exit__
__format__ default object formatter
__getstate__
__new__((S, ...)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__setstate__
__sizeof__
__subclasshook__ Abstract classes can override this to customize issubclass().
_checkClosed
_checkReadable
_checkSeekable
_checkWritable
close(() -> None.  Disable all I/O operations.)
detach Disconnect this buffer from its underlying raw stream and return it.
fileno Returns underlying file descriptor if one exists.
flush(() -> None.  Does nothing.)
getvalue(() -> bytes.) Retrieve the entire contents of the BytesIO object.
isatty(() -> False.) Always returns False since BytesIO objects are not connected to a tty-like device.
read(([size]) -> read at most size bytes, ...) If the size argument is negative, read until EOF is reached.
read1((size) -> read at most size bytes, ...) If the size argument is negative or omitted, read until EOF is reached.
readable(...)
readinto(...) Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.
readline(...) Retain newline.
readlines(([size]) -> list of strings, ...) Call readline() repeatedly and return a list of the lines so read.
seek((pos[, ...) Seek to byte offset pos relative to position indicated by whence: 0 Start of stream (the default).
seekable(...)
tell(() -> current file position, an integer)
truncate(...) Size defaults to the current file position, as returned by tell().
writable(...)
write((bytes) -> int.  Write bytes to file.) Return the number of bytes written.
writelines(...) Note that newlines are not added.

Attributes

closed True if the file is closed.
next