BIG problem if readline strips newlines
Alex Martelli
aleaxit at yahoo.com
Tue Jun 12 18:36:49 EDT 2001
"Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message
news:mailman.992379739.20351.python-list at python.org...
...
"""
> >standard python idioms will no longer work...
> >
> >for line in file.readlines(chomp=1):
> > pass
>
> Um. Think again? Why wouldn't this work?
I think he meant:
while 1:
line = file.readline(chomp=1)
if not line: break
"""
So if you want your lines pre-chomped you have to use
the faster .xreadlines() approach -- doesn't seem a bad
thing to me... incentive towards progress!-)
Alex
More information about the Python-list
mailing list