A fun python CLI program for all to enjoy!
Ethan Furman
ethan at stoneleaf.us
Fri May 6 19:29:19 EDT 2016
On 05/06/2016 04:12 PM, DFS wrote:
> On 5/6/2016 4:30 PM, MRAB wrote:
>> If you don't want to use the 'with' statement, note that closing the
>> file is:
>>
>> f.close()
>>
>> It needs the "()"!
>
> I used close() in 1 place, but close without parens in 2 other places.
> So it works either way. Good catch.
No, it doesn't. `f.close` simple returns the close function, it doesn't
call it. The "it works" was simply because Python closed the files for
you later.
Not a big deal in a small program like this, but still a mistake.
--
~Ethan~
More information about the Python-list
mailing list