readline in while loop
Andrew Koenig
ark at research.att.com
Fri May 23 09:57:26 EDT 2003
>> f = file("test.txt", 'r')
>> for line in f:
>> print line
>> f.close()
Ed> Looks neat. I try to avoid Perl vs. Python flame fest, but are
Ed> some constructs in Python context-sensitive (like in Perl), or is
Ed> this some handy use of iterators in class file?
It relies on the fact that a file is an iterator.
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list