Python生成随机验证码

 import random
    s = ''
    for i in range(6):
        num = random.randint(0,9)
        alpha1 = chr(random.randint(65,90))
        alpha2 = chr(random.randint(97,122))
        ret = random.choice([num,alpha1,alpha2])
        s += str(ret)
    print(s)

  

posted on 2019-09-06 15:05  JentZhang  阅读(188)  评论(0编辑  收藏  举报