title: How to reopen a closed file?
body: <p>I have a file object <code>file</code> that I opened with:</p>
  <pre><code>with open(&quot;text.txt&quot;,&quot;rb&quot;) as file:
      # read some line
  
  file.write(&quot;texte&quot;)  # I know that doesn't work
  </code></pre>
  <p>I just want to know if I can open this file again, because Python has all the information about it, but it says that this file is closed.
  I am trying to read some lines in the file and at the end, I will write a new line at the end of file, so I want to reopen this file in append mode.</p>
  <pre><code>&gt;&gt;&gt; with open(&quot;test.txt&quot;,&quot;wb&quot;) as fich:
  ...     fich.write(&quot;test In &quot;)
  ...
  &gt;&gt;&gt; fich
  &lt;closed file 'test.txt', mode ‘wb' at 0x7f3f49a3a4b0&gt;
  &gt;&gt;&gt; fich.open
  Traceback (most recent call last):
    File “&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  </code></pre>
  <p>I am calling a function that takes the file handle as parameter, so I can't reuse the open as the first time, because the name of the file is unkown inside the function.</p>
  <p>Can I reopen the handle itself? Because I can use the same method and reopen it with:</p>
  <pre><code>with open(&quot;filename&quot;) as anotherfile:
  </code></pre>