Python之random模块

#随机验证码生成
import random

checkcode=''
for i in range(4):
    conut = random.randrange(0,4)
    if conut == i:
        tmp = chr(random.randint(65,90))
    else:
        tmp = random.randint(0,9)
    checkcode += str(tmp)
print(checkcode)

 

posted @ 2017-09-23 09:20  bruce61  阅读(92)  评论(0)    收藏  举报