Python - File Handling Methods

Python - File Handling Methods


The Python has a number of methods and functions that is used for file handling. These methods and functions are listed below in alphabetical order. For more details about any one of these, please visit its page.

File Handling Methods
MethodsDescription
Closes the file
The Python has a number of methods and functions that is used for file handling. These methods and functions are listed below in alphabetical order. For more details about any one of these, please visit its page. Returns the separated raw stream from the buffer
Returns a number that represents the stream, from the operating systems perspective
Flushes the internal buffer
File Handling Methods Returns whether the file stream is interactive or not
Returns the file content
Methods Returns whether the file stream can be read or not
Description Returns one line from the file
Returns a list of lines from the file
close() Change the file position
Returns whether the file allows us to change the file position
Closes the file Returns the current file position
Resizes the file to a specified size
detach() Returns whether the file can be written to or not
Writes the specified string to the file
Returns the separated raw stream from the buffer Writes a list of strings to the file