python_83_random_应用验证码
import random checkcode='' for i in range(0,5):#5位验证码 current=random.randrange(0,5) #字母 if current==i: tmp=chr(random.randint(65,115)) #数组 else: tmp=random.randint(0,9) checkcode+=str(tmp) print(checkcode)
import random checkcode='' for i in range(0,5):#5位验证码 current=random.randrange(0,5) #字母 if current==i: tmp=chr(random.randint(65,115)) #数组 else: tmp=random.randint(0,9) checkcode+=str(tmp) print(checkcode)