words.py 490 Bytes
from io import TextIOWrapper


def get_words() -> list[str]:
    words: list[str] = []
    f: TextIOWrapper = open('06/dictionary.txt')
    for line in f.readlines():
        line = line.strip()
        words.append(line)
    f.close()
    return words


def get_wordle_words() -> list[str]:
    wordle_words: list[str] = []
    for word in get_words():
        if len(word) == 5:
            wordle_words.append(word)
    return wordle_words


WORDLE_WORDS: list[str] = get_wordle_words()