input and output table continued method description tell(returns the current file pointer seek(offset [whence]seeks to new file position isatty(returns if is an interactive terminal flush(flushes the output buffers truncate([size]truncates the file to at most size bytes fileno(returns an integer file descriptor next(returns the next line or raises stopiteration in python it is called __next__(the read(method returns the entire file as string unless an optional length parameter is given specifying the maximum number of characters the readline(method returns the next line of inputincluding the terminating newlinethe readlines(method returns all the input lines as list of strings the readline(method optionally accepts maximum line lengthn if line longer than characters is readthe first characters are returned the remaining line data is not discarded and will be returned on subsequent read operations the readlines(method accepts size parameter that specifies the approximate number of characters to read before stopping the actual number of characters read may be larger than this depending on how much data has been buffered both the readline(and readlines(methods are platform-aware and handle different representations of newlines properly (for example'\nversus '\ \ 'if the file is opened in universal newline mode ('uor 'ru')newlines are converted to '\nread(and readline(indicate end-of-file (eofby returning an empty string thusthe following code shows how you can detect an eof conditionwhile trueline readline(if not lineeof break convenient way to read all lines in file is to use iteration with for loop for examplefor line in fiterate over all lines in the file do something with line be aware that in python the various read operations always return -bit stringsregardless of the file mode that was specified (text or binaryin python these operations return unicode strings if file has been opened in text mode and byte strings if the file is opened in binary mode the write(method writes string to the fileand the writelines(method writes list of strings to the file write(and writelines(do not add newline characters to the outputso all output that you produce should already include all necessary formatting these methods can write raw-byte strings to filebut only if the file has been opened in binary mode lib fl ff