#file_read.py #open and read the integers, one per line, of a file fname = input("Name of text file to read its lines: ") inf = open(fname, "r") #open an existing file for reading. Must exist. num_nums = 0 for line in inf: #includes the \n num = int(line) #assumes one number per line print(num) #or process it, put into list, ... num_nums += 1 inf.close() print("#Numbers:", num_nums)