'''
随机密码生成器
该生成器用于生成6位随机密码,包含A-Z, a-z , 0-9 , - + = @ $ % & ^
'''
import random
#定义密码生成函数
def pass_generator(n):
lst1 = list(range(65,91))
lst2 = list(range(97,123))
lst3 = list(range(10))
lst4 = ['+','-','=','@','#','$','%','^']
s1 = ''.join(chr(c) for c in lst1)
s2 = ''.join(chr(c) for c in lst2)
s3 = ''.join(str(i) for i in lst3)
s4 = ''.join( c for c in lst4)
s = s1 + s2 + s3 + s4
p = ''
for _ in range(n):
p += random.choice(s)
return p
print(pass_generator(32))