import random import string print("欢迎使用密码生成器") def passlength(): print("你想要多长的密码:") global passlen try: input1=input() passlen=int(input1) except: print("请输入一个数字") passlength() if passlen<5: print("太短了??") passlength() elif passlen>30: print("太长了??") passlength() else: print("好的??") passlength() def passwordgen(): chars=string.ascii_letters+string.digits+"@$*!?/" password="" for x in range(passlen): password=password+random.choice(chars) print("你的密码是:"+password) passwordgen()
原文地址:https://www.cnblogs.com/HGNET/p/12120610.html
时间: 2024-10-23 17:45:20