[Tutor] help with list permutations
bertha.rambler at gmail.com
Thu Jan 3 20:06:51 CET 2008
Greeting from a real newbie,
I think that their might exist an easy way, in Python, for my list
permutation issue. I need to be able to permute all elements from across
several lists, while ensuring order is maintained across the lists.
For example: list1=[a b] list2=[c d e] list3=[f] list4=[g h]
permute(list1, list2, list3, list4) =
[ [a c f g], [a c f h], [a d f g], [a d f h], [a e f g], [a e f h],
[b c f g], [b c f h], [b d f g], [b d f h], [b e f g], [b e f h] ]
Of course, the number of the lists is arbitrary and the size of each list is
Any help would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor