This is probably a very easy thing to solve in Python, but I would appreciate anyone's help. I have two lists where I want to loop through but only for matched items:
lista = ['a', 'b', 'c']
listb = ['a1', 'b1', 'c1']
for a in lista:
for b in listb:
print 'my first item is:', a, 'and my second item is:', b
This will print
my first item is: a and my second item is: a1
my first item is: a and my second item is: b1
my first item is: a and my second item is: c1
my first item is: b and my second item is: a1
my first item is: b and my second item is: b1
my first item is: b and my second item is: c1
my first item is: c and my second item is: a1
my first item is: c and my second item is: b1
my first item is: c and my second item is: c1
How can I make it print only:
my first item is: a and my second item is: a1
my first item is: b and my second item is: b1
my first item is: c and my second item is: c1