__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)
本文出自 “9527” 博客,请务必保留此出处http://liangey.blog.51cto.com/9097868/1702983
原文:http://liangey.blog.51cto.com/9097868/1702983