# Load the people from the data file for reading f = open('people.dat', 'r') # read in names, one per line names = f.readlines() # we're done with the file, close it f.close() # each name still has a newline, '\n' on the end of it, let's remove that cleaned_names = [] for name in names: cleaned_names.append(name[:-1]) # now let's print out the names in alphabetical order for name in sorted(cleaned_names): print(name)