You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
429 B
Python

# 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)