bugs at iter file() ?

Terry Reedy tjreedy at udel.edu
Thu Jul 15 00:54:11 EDT 2004


"dw" <dswj at plasa.com> wrote in message news:web-812553 at b1.c.plasa.com...
> Python 2.3.4, winxp:
>
> I have a large text file that unknowingly contains ascii
> character 1A, or chr(26). And doing this:
> for line in file(sys.argv[1]):
>      print line
> would stop iteration at the specific line containing ascii
> char 1A, without raising exception or warning, although
> there were still remaining lines which has not been
> iterated.

To add to what Tim said: From the viewpoint of Windows in its default mode,
there are no remaining lines.  ^Z is the end of file and anything after
that is accidental junk filling out the remainder of the disk block.

tjr






More information about the Python-list mailing list