python check if with open was successfull 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)