f = open('hello.txt', 'w')
f.write('hello, world')
f.close()
This implementation won’t guarantee the file is closed if there’s an exception during the f.write() call#Secure
with open('hello.txt', 'w') as f: f.write('hello, world!')
PY PyNotes @py_notes_uz · 207 subscribers f = open('hello.txt', 'w')
f.write('hello, world')
f.close()
This implementation won’t guarantee the file is closed if there’s an exception during the f.write() callwith open('hello.txt', 'w') as f: f.write('hello, world!')