python生成随机验证码
2018-03-04 18:48
323 查看
利用python 的random函数生成随机数字
然后将数字转换成字母。
字母的ASCII为65 - 91(大写)
然后将数字转换成字母。
字母的ASCII为65 - 91(大写)
import random i = random.randrange(65,91) print(i) temp = "" for i in range(6): num = random.randrange(0, 4) if num == 3 or num == 1: rad2 = random.randrange(0, 10) temp = temp + str(rad2) else: rad = random.randrange(65, 91) c = chr(rad) temp = temp + c print(temp)
相关文章推荐
- python随机生成一个6位的验证码
- Python(4)-- 随机生成N位验证码的字符
- Python3 生成一个随机验证码
- python PIL模块与随机生成中文验证码
- Python 随机生成中文验证码(转载)
- python入门随机生成验证码并验证是否正确
- python 随机生成验证码
- 用Python生成随机的中文验证码图片
- Python生成随机验证码
- 如何利用python生成随机验证码?
- Python 随机生成中文验证码
- Python随机生成验证码的两种方法
- 学习python:实例2.用PIL生成随机验证码
- python生成随机验证码(中文验证码)示例
- Python使用PIL模块生成随机验证码
- python实战系列之生成随机验证码(三)
- Python 生成随机验证码
- python生成随机验证码(中文验证码)示例
- day15 python随机生成验证码的代码
- Python 生成随机验证码