python随机验证码生成脚本(random)

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

发表评论