import random
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-="
length = int(input("请输入密码长度:"))
password = ""
for i in range(length):
password += random.choice(chars)
print("生成的密码为:", password)
标签:chars,random,生成器,密码,length,简单,password From: https://www.cnblogs.com/zmxpython/p/17334794.html