Rita Sue and Bob too
loic.mahe at free.fr
Fri Aug 20 17:49:50 CEST 2004
You can do it with list List Comprehensions:
BigList = ['Jean', 'Eric', 'Remy', 'Anne', 'Denis', 'Alain', 'Armel',
SmallList = ['Eric', 'Denis', 'Georges', 'Jean']
if ( [x for x in SmallList if x in BigList] == SmallList ):
print "They were found"
print "They are not in list"
[x for x in SmallList if x in BigList] evaluates to a list with common
elements of SmallList and BigList
More information about the Python-list