Python生成随机验证码
import random s = '' for i in range(6): num = random.randint(0,9) alpha1 = chr(random.randint(65,90)) alpha2 = chr(random.randint(97,122)) ret = random.choice([num,alpha1,alpha2]) s += str(ret) print(s)
好记性不如烂笔头!
import random s = '' for i in range(6): num = random.randint(0,9) alpha1 = chr(random.randint(65,90)) alpha2 = chr(random.randint(97,122)) ret = random.choice([num,alpha1,alpha2]) s += str(ret) print(s)