首页 > 编程语言 > 详细

python识别验证码

时间:2017-11-04 10:45:31      阅读:289      评论:0      收藏:0      [点我收藏+]

1、python识别验证码依赖 tesseract-ocr-setup-3.02.02.exe,所以首先需要安装 tesseract-ocr-setup-3.02.02.exe

2、然后安装pytesseract,通过pytesseract调用tesseract-ocr来识别验证码。pip install pytesseract

运行代码:

import requests
from PIL import Image
from StringIO import StringIO
import pytesseract

res = requests.get(‘http://xxxxx/validateCode?‘)
#print res.content
i = Image.open(StringIO(res.content))
i.save(‘code.jpg‘,‘JPEG‘)
print pytesseract.image_to_string(i)

python识别验证码

原文:http://www.cnblogs.com/cppsurain/p/7782215.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!