生成随机验证码:

import random

checkcode=""
for i in range(4):
    current=random.randrange(0,4)
    if current == i:
        tmp=chr(random.randint(65,90))#把数字变成字母
    else:
        tmp=random.randint(0,9)
    checkcode+=str(tmp)
print(checkcode)

相关文章:

  • 2021-12-21
  • 2021-12-07
  • 2019-08-09
  • 2021-12-31
  • 2022-02-11
  • 2022-02-08
猜你喜欢
  • 2021-11-06
  • 2018-12-31
  • 2022-12-23
  • 2021-10-30
  • 2021-05-04
  • 2022-12-23
相关资源
相似解决方案