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)

 

posted @ 2018-02-08 19:07  耐烦不急  阅读(147)  评论(0编辑  收藏  举报