生成随机验证码

import random

checkcode = ''
for in range(4):
    current = random.randrange(0,4)
    if current != i:
        temp = chr(random.randint(65,90))
    else:
        temp = random.randint(0,9)
    checkcode += str(temp)
print checkcode
posted on 2018-03-08 11:20  fei2232  阅读(86)  评论(0编辑  收藏  举报