生成六位验证码python代码

生成六位验证码python代码

import random

def Verifi_code():
    code = []
    for i in range(6):
        if i == random.randint(1,5):
            code.append(str(random.randint(1,5)))
        else:
            temp = random.randint(65,90)
            code.append(chr(temp))
    a = ''.join(code)
    return a

b = Verifi_code()

print b
posted @ 2016-07-09 22:06  aallennty  阅读(129)  评论(0编辑  收藏  举报