table file object attributes and methods # syntax description close(closes file object and sets attribute closed to true closed returns true if the file is closed encoding the encoding used for bytes str conversions fileno(returns the underlying file' file descriptor (available only for file objects that have file descriptors flush(flushes the file object isatty(returns true if the file object is associated with console (available only for file objects that refer to actual files mode the mode file object was opened with name file object ' filename (if it has onef newlines the kinds of newline strings encountered in text file __next__(returns the next line from file object in most casesthis method is used implicitlyfor examplefor line in peek(nreturns bytes without moving the file pointer position read(countreads at most count bytes from file object if count is not specified then every byte is read from the current file position to the end returns bytes object when reading in binary mode and str when reading in text mode if there is no more to read (end of file)an empty bytes or str is returned returns true if was opened for reading readable( readintobareads at most len(babytes into bytearray ba and returns the number of bytes read--this is at end of file (available only in binary mode readlinecountreads the next line (or up to count bytes if count is specified and reached before the \ character)including the \ readlinessizehintreads all the lines to the end of the file and returns them as list if sizehint is giventhen reads approximately up to sizehint bytes if the underlying file object supports this seekoffsetwhencemoves the file pointer position (where the next read or write will take placeto the given offset if whence is not given or is os seek_set moves the file pointer to the given offset (which may be negativerelative to the current position if whence is os seek_cur or relative to the end if whence is os seek_end writes are always done at the end in append "amode no matter where the file pointer is in text mode only the return value of tell(method calls should be used as offsets