Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Perfect! Sorry but now I am using it is it also possible to instead of [1, 2, 3], [4, 5, 6], [7, 8, 9] create [1, 2, 3,4, 5, 6,7, 8, 9]? Just one list instead of 3? Commented May 21, 2012 at 10:04
  • you mean merge each combination of the 3 to a single line? or permutations on the whole line? you can do either. if you want to merge the 3 memeber permutation, use [list(itertools.chain(*x)) for x in itertools.permutations(l, len(l))] Commented May 21, 2012 at 10:10