목록의 모든 순서를 생성하려면 어떻게 해야 합니까? 목록의 모든 순서를 생성하려면 어떻게 해야 합니까?예를 들어 다음과 같습니다. 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] 표준 라이브러리에서 사용: import itertools list(itertools.permutations([1, 2, 3])) 여기서 각색한 것은 어떻게 하면itertools.permutations수 . def permutations(elements): if len(elements) AB A..