📜  字符串中的排列 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:18.236000             🧑  作者: Mango

代码示例3
# Function to find permutations of a given string
from itertools import permutations
  
def allPermutations(str):
       
     # Get all permutations of string 'ABC'
     permList = permutations(str)
  
     # print all permutations
     for perm in list(permList):
         print (''.join(perm))
        
# Driver program
if __name__ == "__main__":
    str = 'ABC'
    allPermutations(str)