Using zip()
Submitted by Des on Thu, 08/23/2012 - 15:31
Takes two lists as parameters and returns a list of tuples where the i-th tuple contains the i-th items from each sequence. This is best explained with an example.
>>> x = ['a','b','c']
>>> y = ['d','e','f']
>>> zipped = zip(x,y)
>>> zipped
[('a', 'd'), ('b', 'e'), ('c', 'f')]
>>>