[Solved] what does with open do in this situation [duplicate]

[ad_1]

The with open('task_2.json', 'w') as f: closes the file after the indented code runs. This means that you don’t need the f.close() line. Using a with statement in python is just a safer way to work with files.

[ad_2]

solved what does with open do in this situation [duplicate]