import speling '''assume that module imports dictionary file''' try: text = open("input.txt", r) #assume imput.txt is in same directory except: text = raw_input("Enter text to be checked for spelling errors:") words_in_text = text.split() mispelled = {} for word in words_in_text: if speling.check(word) == 0: mispelled[word] = mispelled.get(word, 0) +1 else: break keys = mispelled.keys() keys = keys.sort() for key in keys: print key + ' (' + mispelled[key] + ')'