Possible Duplicate:
How to get line count cheaply in Python?
I'd like to print how many lines there is in a file.
What I have so far is this, but it prints the number of every line and I'm not sure how to get Python to only print the last one.
filename = input('Filename: ')
f= open(filename,'r')
counter = 1
line = f.readline()
while(line):
clean_line = line.strip()
print(counter)
line = f.readline()
counter += 1
f.close()