listEx = [\'cat *(select: \"Brown\")*\', \'dog\', \'turtle\', \'apple\'] listEx2 = [\'hampter\',\' bird\', \'monkey\', \'banana\', \'cat\'] for j in listEx2: fo
Your problem is that you wrote j instead of i in the last line:
j
i
for j in listEx2: for i in listEx: if j in i: print listEx.index(i) # ^ here
However, a better approach is to use enumerate:
enumerate
for item2 in listEx2: for i, item in enumerate(listEx): if item2 in item: print i