I want to check if a word is in a list of words.
word = \"with\" word_list = [\"without\", \"bla\", \"foo\", \"bar\"]
I tried if word
if word
You could also create a single search string by concatenating all of the words in word_list into a single string:
word = "with" word_list = ' '.join(["without", "bla", "foo", "bar"])
Then a simple in test will do the job:
in
return word in word_list