使用python随机生成20位的数字+大写字母的密码:
import random, string
passwd = []
for i in range(20):
if random.randint(0, 1):
letter = random.choice(string.ascii_uppercase)
passwd.append(letter)
else:
letter = random.choice(string.digits)
passwd.append(letter)
print("".join(passwd))
运行结果:
3IK81S14V19Q25G9M478