I've been having trouble with this for loop that is supposed to iterate through and save a list with all the words in the book.
The error I get is: 'int' object is not iterable.
def create_word_dict ()
word_list = open("mobydick.txt", "r")
all_list = word_list.read()
all_list = all_list.split()
word_list.close()
for index in len(all_list):
all_list[index] = parseString(all_list[index])
return all_list
# Removes punctuation marks from a string
def parseString (st):
s = ""
for ch in st:
if ch.isalpha() or ch.isspace():
s += ch
else:
s += ""
return s #return was outside code block