What is the python keyword "with" used for?
<p>What is the python keyword "with" used for?</p>

<p>Example from: <a href="http://docs.python.org/tutorial/inputoutput.html">http://docs.python.org/tutorial/inputoutput.html</a></p>

<pre><code>&gt;&gt;&gt; with open('/tmp/workfile', 'r') as f:
...     read_data = f.read()
&gt;&gt;&gt; f.closed
True
</code></pre>
