随机四位数验证码 数字加字母

# Author:Zhu Jin Xin
import random
checkcode = ""
for i in range(4):
current = random.randrange(0,4)
if i==current:
tmp = chr(random.randint(65,90))
checkcode+=tmp
else:
tmp = str(random.randint(0,9))
checkcode+=tmp
print(checkcode)
posted @ 2019-01-02 16:57  jjjjjjjjjjjj  阅读(245)  评论(0编辑  收藏  举报