iterating over lines in a file

Grant Edwards nobody at nowhere.nohow
Fri Jul 21 20:43:41 EDT 2000


On Fri, 21 Jul 2000 15:42:17 -0700, Daley, Mark W <mark.w.daley at intel.com> wrote:

>Isn't the argument for readlines() a memory size, as in 512 bytes?  If so,
>it is possible to have 3509 lines that are <= 512 bytes.

Last time I counted, a newline took up one byte in a file for
Unix/MacOS and two bytes for MS-DOS/Windows. Therefore, the
upper bound is 512 for number of lines in a 512 byte file.

There may be some degenerate way to put more that 512 lines in
a 512 byte file under one the eight gazillion file formats
supported by VMS, but off the top of my head, I don't think so.

NB: it looked like to me that the size in question was the sum
of the lengths of all of the lines read, and not the number of
lines read.

-- 
Grant Edwards                   grante             Yow!  I'm sitting on my
                                  at               SPEED QUEEN... To me,
                               visi.com            it's ENJOYABLE... I'm
                                                   WARM... I'm VIBRATORY...



More information about the Python-list mailing list