.close() file method allows the user to close an open file within the IDE.
.close() to close the opened
f = open("gullivers_travels.txt", "r", encoding='utf8')f.close()
The example below opens a file called
example_file.txt and then closes it using
.closed attribute is used to show whether the file is open or closed.
- Anonymous contributorAnonymous contributor3077 total contributions
- Anonymous contributorAnonymous contributor194 total contributions
- net137228473814 total contributions
- Anonymous contributorAnonymous contributor15 total contributions