Data File Handling
We have seen yet only the transient programs. The programs which run for a short period of time and give some output and after that their data is disappeared. And when we again run those programs then we have to use new data.
This is because the data is entered in primary memory which is temporary memory and its data is volatile.
Those programs which are persistent i.e. they are always in running or run for a long time then their data is stored in permanent storage (e.g. Harddisk) . If the program is closed or restarted then the data used will be retrieved.
For this purpose the program should have the capability to read or write the text files or data files. These files can be saved in permanent storage.
The meaning of File I/O (input-output) is to transfer the data from Primary memory to secondary memory and vice-versa.
Why the Files are used?
The data stored with in a file is known as persistent data because this data is permanently stored in the system.
Python provides reading and writing capability of data files.
We save the data in the files for further use.
As you save your data in files using word, excel etc. same thing we can do with python.
A File is a collection of characters in which we can perform read and write functions. And also we can save it in secondary storage.