No need to close file?

skip at pobox.com skip at pobox.com
Tue Jul 18 16:04:16 EDT 2006


    T> Do I need to close the file in this case?  Why or why not?

    T> for line in file('foo', 'r'):
    T>   print line

No.  The magic of reference counting.

S



More information about the Python-list mailing list