Membership of multiple items to a list
inkhorn
matt.dubins at sympatico.ca
Sun Feb 1 14:54:09 EST 2009
Dear all,
I'd like to know how to elegantly check a list for the membership of
any of its items to another list. Not caring for elegance, I would
use the following code:
blah = [1,2,3]
yadda = [3,4,5,6]
blah[0] or blah[1] or blah[2] in yadda
Please tell me how to change the preceding code into something nicer
where I don't have to keep extending the line based on the length of
the first list.
Cheers,
Matt Dubins
More information about the Python-list
mailing list