for line in file('filename'):

Yoav Goldberg yoav.goldberg at gmail.com
Tue Jul 24 16:08:22 CEST 2007


I use the idiom "for line in file('filename'): do_something(line)" quite a
lot.

Does it close the opened file at the end of the loop, or do I have to
explicitly save the file object and close it afterward?


Yoav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070724/544f0ee8/attachment.html>


More information about the Python-list mailing list