Re: all possible matchings of elements of two lists

2009-08-26 Thread Jan Kaliszewski
26-08-2009 o 12:05:41 Sandy wrote: 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 p

Re: all possible matchings of elements of two lists

2009-08-26 Thread Mark Dickinson
On Aug 26, 11:05 am, Sandy wrote: > 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)] >    ] If you're using

Re: all possible matchings of elements of two lists

2009-08-26 Thread dksr
Ok this is how I do it: l1 = [1,2] l2= ['a','b','c'] res = [] l2 = permute(l2) for i in l2: lis = [l1,l2] res.append(zip(*lis)) # or use map depending on what u want res.append(map(None,*lis)) print res On Aug 26, 11:05 am, Sandy wrote: > Hi all, > I basically want all possible m