File Handling in python

What is a file ?
• File is a named location on disk to store related information. It is
used to permanently store data in a non-volatile memory (e.g. hard
• Since, random access memory (RAM) is volatile which loses its data
when computer is turned off, we use files for future use of the data.
• When we want to read from or write to a file we need to open it
first. When we are done, it needs to be closed, so that resources
that are tied with the file are freed.
• Hence, in Python, a file operation takes place in the following order.

Post a Comment