我需要创建一个函数来读取文本文件并创建拼写错误单词的字典。 这就是我目前所拥有的
def spellCheck(textFileName):
file=open("words.txt","r")
wordsList = file.read()
print wordsList
file.close()
file=open(textFileName, "r")
wordsToCheck = file.read()
print wordsToCheck
file.close()
# The next line creates the dictionary
# This dictionary will have the word that has been spelt wrong as the key and the number of times it has been spelt wrong as the value
spellingErrors = dict= {'words', wordsToCheck}
我需要:
^{pr2}$
这非常简单,而且非常缓慢:
相关问题 更多 >
编程相关推荐