#随机生成4位数字的验证码 # import random # # checkcode=‘‘ # # for i in range(4): # current=random.randint(1,9) # checkcode+=str(current) # print(checkcode) #随机生成4位字母和数字组合的验证码 import random checkcode=‘‘ for i in range(4): current=random.randrange(0,4) if current==i: tmp=chr(random.randint(65,90)) else: tmp=random.randint(0,9) checkcode+=str(tmp) print(checkcode)
时间: 2024-10-29 04:03:38