__author__ = 'ley'
#导入random模块
import random
checkcode=''
for i in range(4):
#print(i)
current=random.randrange(0,4)
#print(current)
if current !=i:
#chr65-90为:A-Z字符
temp=chr(random.randint(65,90))
#print(temp)
else:
temp=random.randint(0,9)
#print(temp)
checkcode+=str(temp)
print(checkcode)
转载于:https://blog.51cto.com/liangey/1702983