Tuesday, April 10, 2007

Counting number of lines in a file @ python

f = open(filename)
lines = f.readlines()
f.close()

print "%s has %d lines." % (filename, len(lines))