码迷,mamicode.com
首页 > 编程语言 > 详细

Python之简单验证码实现

时间:2018-04-12 19:52:58      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:ret   dom   pytho   pre   验证码   code   rand   实现   str   

def v_code():
ret = ‘‘
for i in range(5):
num = random.randint(0,9)
alf = chr(random.randint(65,122))
s = str(random.choice([num,alf]))
ret += s
return ret

print(v_code())

Python之简单验证码实现

标签:ret   dom   pytho   pre   验证码   code   rand   实现   str   

原文地址:https://www.cnblogs.com/geeker-xjl/p/8809915.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!