examples/python/iterate_list_of_tuples.py
pair = [
('fname', 'Foo'),
('lname', 'Bar'),
('email', '[email protected]'),
]
for p in pair:
print('{} : {}'.format(p[0], p[1]))
for p in pair:
print('{} : {}'.format(*p))
for field, value in pair:
print('{} : {}'.format(field, value))
And the output will be:
fname : Foo
lname : Bar
email : [email protected]
fname : Foo
lname : Bar
email : [email protected]
fname : Foo
lname : Bar
email : [email protected]