Import re(где ошибка ) with open('input.txt', 'r') as inp: words = re.sub(r'(?i)[^a-z]', ' ', inp.read()).split() a = input("Введите букву: ").lower() with open('output.txt', 'w') as f: for word in words: if a in word: f.write(word + '\n') ответ не выходит в файл )