f = open(filename)
lines = f.readlines()
f.close()
print "%s has %d lines." % (filename, len(lines))
Tuesday, April 10, 2007
Counting number of lines in a file @ python
Subscribe to:
Posts (Atom)
f = open(filename)
lines = f.readlines()
f.close()
print "%s has %d lines." % (filename, len(lines))