Skip to content

Instantly share code, notes, and snippets.

@monzee
monzee / gist:2572256
Created May 1, 2012 23:11 — forked from isa/gist:2571012
Convert in less than 30 lines
from __future__ import print_function
from itertools import chain, combinations
data = [
['A', 'B', 'C'],
['A', 'C', 'E'],
['E', 'F', 'D'],
['D', 'A', 'J'],
['E', 'D', 'J'],
]
pairs = map(sorted, chain(*[combinations(row, 2) for row in data]))