您的位置:首页 > 编程语言 > Python开发

python写的一个验证码小程序

2015-10-14 22:29 701 查看
__author__ = 'ley'
#导入random模块
import random

checkcode=''
for i in range(4):
#print(i)
current=random.randrange(0,4)
#print(current)
if current !=i:
#chr65-90为:A-Z字符
temp=chr(random.randint(65,90))
#print(temp)
else:
temp=random.randint(0,9)
#print(temp)
checkcode+=str(temp)
print(checkcode)

本文出自 “9527” 博客,请务必保留此出处http://liangey.blog.51cto.com/9097868/1702983
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: