对于初学者,如何以最简单的方式显示字符串中的所有排列或任何其他可迭代的排列...
def permutations(iterable):
#code here
例如Permutations("abc")
输出:"abc","acb","bac","bca","cba","cab"
这里:
def permutations(iterable): print(f'"{", ".join(li)}"')
permutations(abc)
输出:
"abc","acb","bac","bca","cba","cab"