all possible matchings of elements of two lists
Sandy
dksreddy at gmail.com
Wed Aug 26 06:05:41 EDT 2009
Hi all,
I basically want all possible matchings of elements from two lists,
Ex: [1,2] [a,b,c]
Required:
[ [(1,a),(2,b)]
[(1,b),(2,c)]
[(1,c),(2,b)]
[(1,b),(2,a)]
[(1,c),(2,a)]
[(1,a),(2,c)]
]
My thought is to get all possible permutations of two lists given and
select any combination and use zip to get the tuples. Repeat this for
all possible combinations.
Any other ideas?
Sandy
More information about the Python-list
mailing list