For Example, i Have 3 lists
list1=['Oh','My','god','I','A','List!']
list2=['Oh','What','You','Dramatic?']
Keyword=['I','Dunno','What','You','Talking','About','DOT']
EDIT
I Want to compare keywords with list 1 and 2 separately. so it would become:
EDIT
common=['What','I','You']
What if i had more than 10 lists? <– optional question.
Since your comment indicates that you want items that exist in both
Keywordand eitherlist1orlist2, you probably don’t want an intersection of all three. Instead you should get the union oflist1andlist2, and then get the intersection of that result andKeyword.Something like the following should give you what you want:
Or an alternative approach that is more extensible (thanks to Karl for the shortened version):