python_83_random_应用验证码

import random
checkcode=''
for i in range(0,5):#5位验证码
    current=random.randrange(0,5)
    #字母
    if current==i:
        tmp=chr(random.randint(65,115))
    #数组
    else:
        tmp=random.randint(0,9)
    checkcode+=str(tmp)
print(checkcode)
原文地址:https://www.cnblogs.com/tianqizhi/p/8432873.html