Question #222

What is the output of the following code snippet?
f = None
with open("data.txt", "w") as f:
    pass
 
print(f.closed)

Here, the with statement guarantees that the file is closed at the end of the block. (effbot.org/zone/python-with-statement.htm)


Comment on Disqus:

Question difficulty: ๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต


Similar questions: