>>> from itertools import permutations >>> [list(p) for p in permutations([1,3,4,6])] [[1, 3, 4, 6], [1, 3, 6, 4], [1, 6, 3, 4], ..., [3, 4, 1, 6]]