如何在Python中生成列表的所有排列,与该列表中的元素类型无关?
例如:
permutations([]) [] permutations([1]) [1] permutations([1, 2]) [1, 2] [2, 1] permutations([1, 2, 3]) [1, 2, 3] [1, 3, 2] [2, 1, 3] [2, 3, 1] [3, 1, 2] [3, 2, 1]
python algorithm permutation combinatorics python-2.5
algorithm ×1
combinatorics ×1
permutation ×1
python ×1
python-2.5 ×1