def test_word(word): '''searches a dictionary file for existance of word given returning 0 if it's not found and 1 if it is. An error message is printed if no dictionary file can be found''' try: dictionary = open("dict.txt", r) #assume dict.txt is in same directory# except: print 'Unable to find dict.txt in this directory' correct_words = dictionary.split() if word in correct_words: correctness = 1 else: correctness = 0 return correctness