how to check if any files are open in python code example
Example: Python program to assess if a file is closed or not
with open('file1.txt','r') as f:
print(f.closed)
f.close()
print(f.closed)
with open('file1.txt','r') as f:
print(f.closed)
f.close()
print(f.closed)