common elements between list of lists and lists

Alexandr N Zamaraev tonal at promsoft.ru
Thu Jul 17 10:45:48 CEST 2008


 >>> list4 = [['1', 'a'],['4', 'd'],['8', 'g']]
 >>> list5 = [1, 2, 3]
 >>> set5 = set(list5)
 >>> [x for n, x in list4 if int(n) in set5]
['a']




More information about the Python-list mailing list