码迷,mamicode.com
首页 > 其他好文 > 详细

随机生成验证码import random

时间:2016-12-24 17:04:53      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:bsp   div   pre   随机   pytho   style   random   env   port   

 1 #!/usr/bin/env python
 2 import random
 3 temp = ""
 4 for i in range(6) :
 5     num = random.randrange(0, 4)
 6     if num == 3 or num == 1 :
 7         rad2 = random.randrange(0, 10)
 8         temp = temp + str(rad2)
 9     else :
10         rad1 = random.randrange(65, 91)
11         c1 = chr(rad1)
12         temp = temp + c1
13 print(temp)

 

随机生成验证码import random

标签:bsp   div   pre   随机   pytho   style   random   env   port   

原文地址:http://www.cnblogs.com/shiluoliming/p/6217319.html

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