This tutorial will cover another function of file handling i.e. Closing a file.
Its very important to close a file after reading or writing in file
Closing a file will free up the resources. We use
close() method to perform this operation in Python.
#example 1 f = open("abc.txt")f.close()
It is a good practice to use the close() method to close a file.
#example 2 f = open("myfile.txt", "r") print(f.readline()) #will print data line by line f.close()