how to count lines in a file ?

Shagshag13 shagshag13 at yahoo.fr
Tue Jul 23 12:54:45 EDT 2002


"Chris Liechti" <cliechti at gmx.net> a écrit dans le message de news: Xns9254BFA8ABAABcliechtigmxnet at 62.2.16.82...
> "Shagshag13" <shagshag13 at yahoo.fr> wrote in
> news:ahk020$tl4ue$1 at ID-146704.news.dfncis.de:
>
> > i need to count lines in a file (that i *can't* keep in memory, so
> > can't use readlines())
>
> but you can use xreadlines, or a bit nicer in Py2.2 where "file" is an
> iterator.

i use file because i read this in documentation :

open(filename[, mode[, bufsize]])
An alias for the file() function above.

does xreadlines will speed my function ?

thanks,

s13.







More information about the Python-list mailing list