import itertools
print list(itertools.permutations([0, 1, 2],3))
结果是
[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]
import itertools
print list(itertools.permutations([0, 1, 2],3))
结果是
[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]