def get_pwd(str, num):#str为可选字符集,num为密码长度
if(num == 1):
for x in str:
yield x
else:
for x in str:
for y in get_pwd(str, num-1):
yield x+y
strKey=""#可选字符集
for i in range(33,127):#所有可见字符
strKey+=chr(i)
for x in get_pwd(strKey,17):
#x+="0823}"
print(x)
转载于:https://www.cnblogs.com/WangAoBo/p/6365059.html
本文介绍了一个使用Python编写的密码生成器函数,该函数通过递归方式生成指定长度的密码,密码由所有可见ASCII字符组成。文章提供了完整的代码实现,并解释了如何通过调整参数来生成不同长度的密码。
1845

被折叠的 条评论
为什么被折叠?



