30
如何生成列表的所有排列?
如何在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]