Hmmm, Beazley book missing something?
Jake Speed
speed at ?.com
Tue Aug 1 16:54:55 EDT 2000
morpheus at here.not.there (Steve Lamb) wrote in
<slrn8oedf7.3li.grey at teleute.rpglink.com>:
>On Tue, 01 Aug 2000 20:39:56 GMT, Steve Lamb <grey at despair.rpglink.com>
>wrote:
>> I see readline and readlines in there. Only mention of it is in
>> the
>>multifile object. No __doc__ string for those methods, either. Did
>>this get overlooked in this book?
> To be honest, the web page doesn't appear to have it in the relevant
>sections, either.
Library Reference -> Built-in Types -> File Objects
http://www.python.org/doc/current/lib/typesother.html#SECTION004179000000000000000
Actually, for the 'while(<>)' idiom, you probably want:
import fileinput
for line in fileinput.input():
do_stuff(line)
http://www.python.org/doc/current/lib/module-fileinput.html
Caveat: fileinput is a little slow, being written in
Python rather than C, but if do_stuff() does a lot of
stuff it probably doesn't matter.
-Speed!
More information about the Python-list
mailing list