I need help for that as Im beginner what i can do if i want to search on cat with regular expression any number of spaces and check if it in list or not as in match exact ... any help
import re
l = ["hello asma", " cat", "welcome"]
# iterates over three elements in the list
r = re.compile(r".*cat")
word_search="cat"
if r in l:
print("yes in")
else:
print("not found")