EDIT: Problem was due to a different part of my code. I thought it was the for loop
I have a for loop in python that goes like this:
for x in OrderedList:
if x in ResultList1:
print x, '1'
elif x in ResultList2:
print x, '2'
elif x in ResultList3:
print x, '3'
The problem is if it finds x in ResultList1 and ResultList2, it prints x,'1' and x,'2' but I want it to get the next value for x if it finds x in ResultList1, not look in 2 and 3 also.
Your code already does that.
The other way you can move to the next element is to use
continue:However it’s unnecessary here because you are using
elif.