Basic file operation questions

Marc Huffnagle mhuffnagle at knowtechnology.net
Tue Feb 8 09:56:03 EST 2005


When you read a file with that method, is there an implied close() call 
on the file?  I assume there is, but how is that handled?

Caleb Hattingh wrote:
> Peter, that was very clear, thanks.
> 
> 
>>So not only is
>>
>>for line in file(...):
>>   # do stuff
>>
>>the most elegant, it is also the fastest. file.readlines() comes
> 
> close, but
> 
>>is only viable for "small" files.
> 
> 

      Marc



More information about the Python-list mailing list