how to count lines in a file ?
Bo M. Maryniuck
b.maryniuk at forbis.lt
Wed Jul 24 05:05:48 EDT 2002
On Tuesday 23 July 2002 19:02, Bjorn Pettersen wrote:
> Now, why on earth would you use that monstrosity instead of:
>
> for line in open(filename):
> count += 1
Or even:
print len(open('/etc/passwd').readlines())
--
Sincerely yours, Bogdan M. Maryniuck
"Absolutely nothing should be concluded from these figures except that
no conclusion can be drawn from them."
(By Joseph L. Brothers, Linux/PowerPC Project)
More information about the Python-list
mailing list