File Input/Output_Case Closed?


Oops, try again. It looks like your file isn't closed!

my_file= open ('text.txt','w')
my_file.write("Not closing files is VERY BAD.")
with open("text.txt", "w") as textfile:
if my_file.closed=='False':
print my_file.closed


my_file.closed will return boolean values like : True / False
You're comparing it with string 'False'


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.