using dictionary to assign misspelled words to its line number
- by jad
This is the code I have so far
d = {}
counter = 0
for lines in words:
counter += 1
for word in text1:
if word not in words:
d[word] = [counter]
else:
d[word].append(counter)
print(word, d[counter])
words = my text file
text1 is my misspelled words
But this gives me an error. What I want to do is print the word and the line number e.g.
togeher 5 7