python递归实现"abcd"字符串全排列
1.保持a不动,动bcd
2.保持b不动,动cd
3.保持c不动,动d
def pailie(head="",string=""):
if len(string)>1:
for father_string in string:
pailie(head+father_string,string.replace(father_string,"")) #关键一点:将头和尾全部传下去
else:
print(head+string)
pailie(string="abcd")