加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
passwordGen.py 904 Bytes
一键复制 编辑 原始数据 按行查看 历史
Jérôme Krell 提交于 2019-10-10 14:22 . Reformat Code by PyCharm-Community
import random
lChars = 'abcdefghijklmnopqrstuvwxyz'
uChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '1234567890'
specialChars = '!@#$%^&*-_+='
passLen = 10 # actual generated password length will be this length + 1
myPass = ''
for i in range(passLen):
while (len(myPass)) <= 2:
index = random.randrange(len(lChars))
myPass = myPass + lChars[index]
myPassLen = len(myPass)
while (len(myPass)) <= 5:
index = random.randrange(len(digits))
myPass = myPass + digits[index]
myPassLen = len(myPass)
while (len(myPass)) <= 7:
index = random.randrange(len(specialChars))
myPass = myPass + specialChars[index]
myPassLen = len(myPass)
while (len(myPass)) <= 10:
index = random.randrange(len(uChars))
myPass = myPass + uChars[index]
myPassLen = len(myPass)
print(myPass)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化