📜  python打印字符串组合 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:45.223000             🧑  作者: Mango

代码示例2
import itertools
 
if __name__ == '__main__':
 
    nums = list("ABC")
    permutations = list(itertools.permutations(nums))
 
    # Output: ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']
    print([''.join(permutation) for permutation in permutations])