Hi,
I have a list of two-item lists and need to search for things in it.
If the list is:
list =[ ['a','b'], ['a','c'], ['b','d'] ]
I can search for a pair easily by doing
['a','b'] in list
Now, is there a way to see if I have a pair in which a string is present in just the second position? I can do this:
for i in range (0, len(list)):
if list[i][1]==search:
found=1
But is there a (better) way without the for
loop? I don't need to know i
or keep the loop going after it's found.