# 生成一个六位随机验证码

import random
# random 生成随机数
temp = ''
for i in range(6):
    num = random.randrange(0,6)
    if num == 3 or num == 1:     #如果循环到3 或 1 生成随机数字0~9
        rad2 = random.randrange(0,10)

        temp = temp+str(rad2)

    else:   #否则  随机生成字母
        rad1 = random.randrange(65,91)     #大于等于65 小小于等于91
        c1 = chr(rad1)
        temp = temp + c1
print(temp)

 

相关文章:

  • 2022-12-23
  • 2021-12-31
猜你喜欢
  • 2021-12-31
  • 2022-01-26
  • 2022-12-23
相关资源
相似解决方案