Possible Duplicate:
Python Check if all of the following items is in a list
So I want to test whether both word and word1 are in the list lst. Of course, I could write:
if word in lst and word1 in lst:
do x
But I wondered if I could shorten that statement to something like:
if (word and word1) in lst:
do x
Of course, that does not work, but is there anything effectively similar that will?
I tried the following, but as you can see, it does not yield the desired result.
>>> word in lst
True
>>> word1 in lst
True
>>> (word, word1) in lst
False
EDIT: Thank you for the answers, I think I have a pretty good idea of how to do this now.