import re def isword(string): pat = re.compile('[a-zA-Z]+') match = pat.search(string) str = match.group() if str == string: return 1 else: return 0 def findword(word): dict = open('dict.txt') for line in dict: line0 = line.strip() if line0 == word: return 1 word0 = word[0].lower() + word[1:len(word)] if line0 == word0: return 1 return 0