how to count lines in a file ?

Andreas Kostyrka andreas at kostyrka.priv.at
Sat Jul 27 04:08:47 EDT 2002


Am Die, 2002-07-23 um 19.06 schrieb Chris Liechti:

> xreadlines does read lines on demand, instead of loading the entire file.
> (like range and xrange). and yes "file is open" i think it was introduced
> because of the "for line in file(...)" idiom, it sound better so than with 
> open...
Well, AFAIK file was introduced because all the other types have got
"type constructors", and while open is such a constructor in function,
it's got the wrong name for files.

Andreas





More information about the Python-list mailing list