I'm looping through 2D list combined from list1 and list2 with itertools. I want to check every value if exists from list1 with every value from list2, so it looks like this:
if(list1[0] == list2[0])
if(list1[0] == list2[1])
if(list1[0] == list2[3])
if(list1[1] == list2[0])
.
.
.
.
If the value is found then continue looping but with list1[+1].
So
if list1[0] == list2[3] = True
I want to start with list[1] again and try it, by skipping the rest of list1[0] comparing.
I tried to explain the best, maybe the code will help you understand.
import itertools
list1 = ["value1","value2","value3","value4"]
list2 = ["value5","value6","value1","value8"]
mylist = list(itertools.product(list1, list2))
for a,b in mylist:
if (a == b):
print ("Found word " + str(a) + " in list2)
continue
So now, after it's found, it needs to continue looping but with a[+1]. However it could work in "classic" loop, but I'm using 2D looping. Basically, I want to continue with "a" comparing to "b" again.