# print out the lines of the file file = open('filename.txt', 'r') for line in file: print(line.strip()) file.close() # print out the populations from a datafile of 2 columns file = open("population.txt") for line in file: (year, pop) = line.split() print(pop) file.close()