1 import random 2 3 i = 0 4 s = '' 5 while i < 5: 6 7 num = random.randint(0,9) 8 alp = chr(random.randint(65,90)) 9 add = str(random.choice([num,alp]... ...
分类:
其他好文 时间:
2018-03-27 20:59:01
阅读次数:
151
【1】random() 大于0且小于1之间的小数,float 【2】randint(a,b) 大于等于a且小于等于b之间的整数 【3】randrange(a,b) 大于等于a且小于b之间的整数 【4】choice([a,b,c]) a或者b或者c 【5】sample() 【6】uniform(a,b ...
分类:
其他好文 时间:
2018-03-11 21:40:02
阅读次数:
156
1、cookie案例 2、HttpSeession原理: 3、使用HttpSession简单购物车案例 4、完成用户一次性登录 5、随机验证码的应用 6、防止表单重复提交及Base64位编码 7、客户端禁用coookie后的会话保存 8、HttpSession对象的状态 ...
分类:
其他好文 时间:
2018-03-11 21:06:47
阅读次数:
130
import random def v_code(n):#随机生成包含数字、大小写字母的验证码 code ='' for i in range(n): add = random.choice([random.randrange(10), chr(random.randrange(65, 91)), ... ...
分类:
其他好文 时间:
2018-03-10 16:03:56
阅读次数:
150
练习题 请配置logging模块,使其在屏幕和文件里同时打印以下格式的日志 json、pickle、shelve三个区别是什么? 打印出命令行的第一个参数。例如: 代码如下: 通过configparser模块完成以下功能 文件名my.cnf 写一个6位随机验证码程序(使用random模块),要求验证 ...
分类:
其他好文 时间:
2018-02-24 11:44:05
阅读次数:
190
1. 用一行输出所有大(小)写字母,以及数字 2. 生成随机验证码 ...
分类:
编程语言 时间:
2018-02-14 12:23:02
阅读次数:
241
程序中有很多地方需要用到随机字符,比如登录网站的随机验证码,通过random模块可以很容易生成随机字符串 random.random() 用于生成一个0到1的随机符点数: 0 <= n < 1.0 random.randint()的函数原型为:random.randint(a, b),用于生成一个指 ...
分类:
其他好文 时间:
2018-02-10 14:56:20
阅读次数:
188
一、random模块 常用方法如下: 生成随机验证码: 洗牌 二、os模块 主要方法: ...
分类:
其他好文 时间:
2018-02-09 22:35:01
阅读次数:
202
from PIL import Imagefrom PIL import ImageDrawfrom PIL import ImageFontfrom pylab import *import random,numpy,stringpath = "G:\python文件"text = random. ...
分类:
编程语言 时间:
2018-02-01 23:11:59
阅读次数:
181
程序中有很多地方需要用到随机字符,比如登录网站的随机验证码,通过random模块可以很容易生成随机字符串 ...
分类:
编程语言 时间:
2018-01-25 20:46:26
阅读次数:
169