Account
Categories

close() Method


Definition:

The close() method closes the file, and after that, you cannot read or write it.

Syntax:

file_object.close()

Example:

file = open("file1.txt", "w")

file.write("www.edutation.com")

file.close()

Output: