File A file-like object for reading and writing data. Created by the open method of the Operator class. closed property # Whether this file is closed. Returns# bool True if this file is closed. close() # Close this file. This also flushes write buffers, if applicable. Notes# A closed file cannot be used for further I/O operations. flush() # Flush the underlying writer. Notes# Is a no-op if the file is not writable. read(size=None) # Read at most size bytes from this file. If size is not specified, read until EOF. Parameters# size : int, optional The maximum number of bytes to read. Returns# bytes The bytes read from this file. readable() # Whether this file can be read from. Returns# bool True if this file can be read from. readinto(buffer) # Read bytes into a pre-allocated buffer. Parameters# buffer : bytes | bytearray A writable, pre-allocated buffer to read into. Returns# int The number of bytes read. readline(size=None) # Read one line from this file. If size is not specified, read until newline. Parameters# size : int, optional The maximum number of bytes to read. Notes# Retains newline characters after each line, unless the file’s last line has no terminating newline. Returns# bytes The bytes read from this file. seek(pos, whence=0) # Change the position of this file to the given byte offset. Parameters# pos : int The byte offset (position) to set. whence : int, optional The reference point for the offset. 0: start of file (default); 1: current position; 2: end of file. Returns# int The new absolute position. seekable() # Whether this file can be repositioned. Notes# This is only applicable to readable files. Returns# bool True if this file can be repositioned. tell() # Return the current position of this file. Returns# int The current absolute position. writable() # Whether this file can be written to. Returns# bool True if this file can be written to. write(bs) # Write bytes to this file. Parameters# bs : bytes The bytes to write to the file. Returns# int The number of bytes written.