-
-
Save muxueqz/3aebbcb80199fb85d04e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worddict = set() | |
with open ('words.txt') as fh: | |
lines = fh.readlines() | |
for element in lines: | |
words = element.rstrip() | |
worddict.add(words) | |
print '{0} words in spelling words'.format(len(worddict)) | |
with open ('3-2_example.txt') as ex: | |
# exlines = ex.read().split() | |
# exlines = ex.read().split('\n') | |
count = 0 | |
# for exelement in exlines: | |
for line in ex.readlines(): | |
count = count + 1 | |
for exelement in line.split(): | |
exwords = exelement.strip('.').strip(',').strip(';').strip(':').lower() | |
if exwords not in worddict: | |
print 'misspelled word on line {0}: {1}'.format(count, exwords) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment