On 10/7/2012 12:15 PM, Token Type wrote:

In this case, I need to use loop to iterate each element in the above
pairs. How can I refer to each element in the above pairs, i.e. pairs
= [(car, automobile), (gem, jewel), (journey, voyage) ]. What's the
index for 'car' and for 'automobile'? Thanks for your tips.

>>> pairs = [('car', 'automobile'), ('gem', 'jewel')]
>>> pairs[0][0]
'car'
>>> pairs[1][1]
'jewel'
>>> for a,b in pairs: a,b

('car', 'automobile')
('gem', 'jewel')

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to