creating pairs of items in a list code example
Example: python create pairs from list
>>> for pair in itertools.combinations([1,2,3,4],2):
... print pair
...
(1, 2)
(1, 3)
(1, 4)
(2, 3)
(2, 4)
(3, 4)
>>> for pair in itertools.combinations([1,2,3,4],2):
... print pair
...
(1, 2)
(1, 3)
(1, 4)
(2, 3)
(2, 4)
(3, 4)