随机验证码模块(random)
1. 生成一个6位数字+字母的验证码 (面试题)
import random
l = []
for i in range(6):
alpha = chr(random.randint(65,90))
alpha_lower = chr(random.randint(97,122))
num = str(random.randint(0,9))
ret = random.choice([alpha,num,alpha_lower])
l.append(ret)
print(''.join(l))