One line, probably pretty fast:

num_lines = sum(1 for line in open('myfile.txt'))