A file object is created using an open function and here is a list of functions that can be called on this object -
|Sr.No.||Methods with Description|
Close the file. A closed file cannot be read or written anymore.
Flush the internal buffer, like stdio's flush. This may be a no-op on some file-like objects.
Returns the integer file descriptor that is used by the underlying implementation to request I/O operations from the operating system.
Returns 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.
Reads at most size bytes from the file (less if the read hits EOF before obtaining size bytes).
Reads one entire line from the file. A trailing newline character is kept in the string.
Reads until EOF using readline() and returns a list containing the lines. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totaling approximately sizehint bytes (possibly after rounding up to an internal buffer size) are read.
Sets the file's current position
Returns the file's current position
Truncates the file's size. If the optional size argument is present, the file is truncated to (at most) that size.
Writes a string to the file. There is no return value.
Writes a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings.
Let us go through them briefly:
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.