#生成验证码
checkcode = “”
for i in range(4):
index = random.randrange(0,4)
#print(i)
#print(index)
if index != i and index + 1 != i:
checkcode+=chr(random.randint(65,90))
elif index + 1 == i:
checkcode += chr(random.randint(97,122))
else:
checkcode += str(random.randint(1,9))
print(“验证码:”,checkcode)
【python】随机生成验证码
最新推荐文章于 2023-04-06 20:41:00 发布