Python学习-------random模块(随机验证码)
2021-06-19 11:06
标签:port random模块 code lse color and add rand import Python学习-------random模块(随机验证码) 标签:port random模块 code lse color and add rand import 原文地址:https://www.cnblogs.com/yujin123456/p/9690424.htmlimport random
def v_code():
code = ‘‘
for i in range(5):
# if i == random.randint(0,5):
# add = random.randrange(10)
# else:
# add = chr(random.randint(65,91))
add =random.choice([random.randrange(10),chr(random.randint(65,91))])
code += str(add)
return code
a = v_code()
print(a)
文章标题:Python学习-------random模块(随机验证码)
文章链接:http://soscw.com/essay/95929.html