File Input/Output_Case Closed?


#1

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:
textfile.write("Success!")
if my_file.closed=='False':
my_file.close()
print my_file.closed


#2

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


#3

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