import random
# 生成随机验证码
# 数字验证码
check_code = ''
for i in range(4):
current = random.randint(1, 9)
check_code += str(current)
print(check_code)
# 随机字母+数字验证码
check_code = ''
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)
check_code += str(tmp)
print(check_code)
原文链接:https://www.cnblogs.com/victorstudy/p/11103929.html
如有疑问请与原作者联系
标签:生成
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有