io.IOBase.writelines()

writelines(lines) Write a list of lines to the stream. Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.

io.IOBase.writable()

writable() Return True if the stream supports writing. If False, write() and truncate() will raise OSError.

io.IOBase.truncate()

truncate(size=None) Resize the stream to the given size in bytes (or the current position if size is not specified). The current stream position isn’t changed. This resizing can extend or reduce the current file size. In case of extension, the contents of the new file area depend on the platform (on most systems, additional bytes are zero-filled). The new file size is returned.

io.IOBase.tell()

tell() Return the current stream position.

io.IOBase.seekable()

seekable() Return True if the stream supports random access. If False, seek(), tell() and truncate() will raise OSError.

io.IOBase.seek()

seek(offset[, whence]) Change the stream position to the given byte offset. offset is interpreted relative to the position indicated by whence. The default value for whence is SEEK_SET. Values for whence are: SEEK_SET or 0 – start of the stream (the default); offset should be zero or positive SEEK_CUR or 1 – current stream position; offset may be negative SEEK_END or 2 – end of the stream; offset is usually negative Return the new absolute position. New in version 3.1: The SEEK_* const

io.IOBase.readlines()

readlines(hint=-1) Read and 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. Note that it’s already possible to iterate on file objects using for line in file: ... without calling file.readlines().

io.IOBase.readline()

readline(size=-1) Read and return one 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 newline argument to open() can be used to select the line terminator(s) recognized.

io.IOBase.readable()

readable() Return True if the stream can be read from. If False, read() will raise OSError.

io.IOBase.isatty()

isatty() Return True if the stream is interactive (i.e., connected to a terminal/tty device).