随机生成验证码:
此功能利用了chr 和random功能
1 res =‘‘ 2 for i in range(6): 3 num = str(random.randint(0,9)) 4 al_num = random.randint(97,122) 5 al_num2 = random.randint(65,90) 6 alpha = chr(al_num) 7 alpha2 = chr(al_num2) 8 res += random.choice([num,alpha,alpha2]) 9 print(res)
原文地址:https://www.cnblogs.com/ZJGG/p/9070683.html
时间: 2024-10-13 20:34:36