import itertools

str = input('请输入一个字符串:')
lst = []
for i in range(1, len(str)+1):
    lst1 = [''.join(x) for x in itertools.permutations(str, i)]
    lst += lst1

print(lst)

主要使用的itertools库

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2021-07-31
  • 2022-12-23
  • 2021-04-30
  • 2022-12-23
猜你喜欢
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-01-26
  • 2022-12-23
相关资源
相似解决方案