Hi, this does compile but I only want results that have the same amount of characters as the input! Can anyone shed some light on this as I can't figure it out myself! thanks.
import re # opens a .txt file and searches for matching letters in words that are same length as the input! file = open("words.txt","r") text = file.readlines() file.close() name = input("enter your name: ") keyword = re.compile(r"[name]") for i in text: if keyword.search(i): print(i) else: print("")