Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import ascii_uppercase
- from PyDictionary import PyDictionary # type: ignore
- DICTIONARY = PyDictionary()
- WORD = "RAFT"
- def standardize(word):
- return word.strip().upper()
- with open("./words.txt", "r") as f:
- words = set(map(standardize, f.readlines()))
- for letter_idx in range(len(WORD)):
- new_word = list(WORD)
- for sub in ascii_uppercase:
- new_word[letter_idx] = sub
- new_str = "".join(new_word)
- if new_str in words:
- print(new_str)
- try:
- print(DICTIONARY.meaning(new_str))
- except Exception:
- print("No meanings found")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement