python close file automatically like context manager
<p>How to close this file or does the file automatically gets closed like a context manager <code>with</code></p>

<pre><code>lines = open(file_name).readlines()
</code></pre>

<p>I wanted to avoid the <code>with</code> statement as the above statement is a one liner, but now i see that the above said statement is of no use since we cannot close the file.  </p>

<pre><code> with open(file_name)  as f:
          .....
</code></pre>