So now I have 2 lists,
list1 = [[0,1],[0,2],[0,10]]
list2 = [[1, ['miniwok', 'food1']], [2,['chicken', 'food2']], [3,['duck', 'food3']], ..... , [10, ['pizza', 'food10']]]
I want to compare the all 2nd element in list1 and if it exists in list2, print the corresponding list. so the result I want is something like this:
[[1, 'miniwok'],[2, 'chicken'],[10,'pizza']]
I tried using nested for loop but I think I'm doing something wrong
for x in range(len(list1)):
for y in range(1, len(list2)+1):
if(list1[x][1] == list2[y]):
result = [y, list2[y][0]]
fstore.append(result)