I want to compare word by word whether the word exists in the list.
items=["michael jackson","nintendo"] aa = ["i think michael jackson is cool","i love nintendo"] for i, a in zip(items, aa): token=a.split() for x in token: if x in i: print "X: " + x
X: i X: michael X: jackson X: i X: nintendo
X: michael X: jackson X: nintendo
As you can see, "i" is also printed out because "i" is in "michael" and "nintendo", but i do not want that. Note that I want to compare words by words in "items" and "aa", by comparing the items in the same index.