def num_lines (filename): ''' Count the number of lines of file''' return sum(1 for line in open(filename))