Hi all,<br>    I put files in a list, just like this module:<br>    <br>#! /usr/bin/python<br># -*- coding=utf-8 -*-<br><br><br>fileList = []<br><br>def openFiles():<br>    for i in range(0,2):<br>        fname = &quot;file%s&quot;%i<br>
        f = open(fname,&quot;a&quot;)<br>        fileList.append(f)<br>        <br>def closeFiles():<br>    for f in fileList:<br>        f.close()<br>    <br>if __name__==&quot;__main__&quot;:<br>    openFiles()<br>    print &quot;fileList<br>
    closeFiles()<br>    print fileList<br>    openFiles()<br>    print fileList<br><br>    I found that after closing files some closed files were left in the list:<br><br>open files:[&lt;open file &#39;file0&#39;, mode &#39;a&#39; at 0xb7be1430&gt;, &lt;open file &#39;file1&#39;, mode &#39;a&#39; at 0xb7be1480&gt;]<br>
close files:[&lt;closed file &#39;file0&#39;, mode &#39;a&#39; at 0xb7be1430&gt;, &lt;closed file &#39;file1&#39;, mode &#39;a&#39; at 0xb7be1480&gt;]<br>open files again:[&lt;closed file &#39;file0&#39;, mode &#39;a&#39; at 0xb7be1430&gt;, &lt;closed file &#39;file1&#39;, mode &#39;a&#39; at 0xb7be1480&gt;, &lt;open file &#39;file0&#39;, mode &#39;a&#39; at 0xb7be14d0&gt;, &lt;open file &#39;file1&#39;, mode &#39;a&#39; at 0xb7be1520&gt;]<br>
<br>   After I call openFiles() and closeFiles() many times, the list will become fatter and fatter, filled with valueless closed file object. How could I open the closed file? I can&#39;t find the way in python document.<br>