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)

  

转载于:https://www.cnblogs.com/JentZhang/p/11474908.html

你可能感兴趣的:(Python生成随机验证码)