with open(filename) as openedfile:
    s = set()
for line in openedfile:
    line.rstrip()
words = line.split()
for word in words:
    s.update(words)
lst = list(s)
lst.sort()
print(lst)
How do I convert a text file into a list while deleting duplicate words and sorting the list in Python?