0

This is what I mean by sorting (5 items in this example, this is not code):

[1, 2, 3, 4, 5]
[1, 2, 3, 5, 4]
[1, 2, 4, 3, 5]
etc.

It is some kind of factorial function. Without items repeating.

Ronen
  • 335
  • 4
  • 11
  • 2
    http://stackoverflow.com/questions/104420/how-to-generate-all-permutations-of-a-list-in-python – simon May 29 '15 at 09:20

1 Answers1

2

Use itertools:

import itertools
print [i for i in itertools.permutations([1,2,3,4,5])]
rajeshv90
  • 574
  • 1
  • 7
  • 17
DeepSpace
  • 78,697
  • 11
  • 109
  • 154