filename = raw_input("Enter the file name: ") datain = file(filename, "r") for line in datain: print len(line) datain.close()