Open alcrene opened 7 months ago
As far as I know, there is no advantage to using f = open() ... f.close() when with open() as f: will do. The with form deals better with corner cases where program execution ends unexpectedly, and is generally more Pythonic.
f = open() ... f.close()
with open() as f:
with
As far as I know, there is no advantage to using
f = open() ... f.close()
whenwith open() as f:
will do. Thewith
form deals better with corner cases where program execution ends unexpectedly, and is generally more Pythonic.