What is the python keyword “with” used for?
Example from: http://docs.python.org/tutorial/inputoutput.html
>>> with open('/tmp/workfile', 'r') as f:
... read_data = f.read()
>>> f.closed
True
What is the python keyword “with” used for?
Example from: http://docs.python.org/tutorial/inputoutput.html
>>> with open('/tmp/workfile', 'r') as f:
... read_data = f.read()
>>> f.closed
True