Python: context managers for cleanup
pythonpatterns
Use with for files, locks, and other resources.
with open('notes.txt', 'w') as f:
f.write('hi') Use with for files, locks, and other resources.
with open('notes.txt', 'w') as f:
f.write('hi')