I am write a python code to list all the words in a file.
fname = input("Enter file name: ")
fh = open(fname)
lst = list()
word = list()
for line in fh:
lst = line.split()
for w in lst :
if not w in word :
word = word.append(w)
word = word.sort()
print(word)
Why does it show
> if not w in word :
> TypeError: argument of type 'NoneType' is notiterable
Thanks, Michael