reading line by line

Michael P. Soulier msoulier at storm.ca
Sun Jan 14 15:30:38 EST 2001


In article <d9i86.6515$AH6.966365 at newsc.telia.net>, Fredrik Lundh wrote:

>The standard pydiom is:
>
>    while 1:
>        line = file.readline()
>        if not line:
>            break
>        ...
>
>In the current cvs version, you can also use:
>
>    for line in file.xreadlines():
>        ...
>
>where xreadlines is a lazy version of readlines (cf. xrange)

    Excellent, thank you.

    Mike

-- 
Michael P. Soulier <msoulier at storm.ca>
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to UNIX
PGP Public Key: http://24.43.42.96/email.phtml



More information about the Python-list mailing list