import random

##生成随机验证码

def make_code(n):
    res = ''
    for i in range(n):
        current = random.randint(0,n)
        if current == i:
            tmp = chr(random.randint(65,90))
        else:
            tmp = random.randint(0,9)
        res += str(tmp)
    print(res)

make_code(5)

 

相关文章:

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