Python File Methods
A file object is created using open function and here is a list of functions which can be called on this object:
|SN||Methods with Description|
Close the file. A closed file cannot be read or written any more.
Flush the internal buffer, like stdio's fflush. This may be a no-op on some file-like objects.
Return the integer file descriptor that is used by the underlying implementation to request I/O operations from the operating system.
Return True if the file is connected to a tty(-like) device, else False.
Returns the next line from the file each time it is being called.
Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes).
Read one entire line from the file. A trailing newline character is kept in the string.
Read until EOF using readline() and return a list containing the lines. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (possibly after rounding up to an internal buffer size) are read.
Set the file's current position.
Return the file's current position
Truncate the file's size. If the optional size argument is present, the file is truncated to (at most) that size.
Write a string to the file. There is no return value.
Write a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings.