python 驗證碼test

來源:互聯網
上載者:User

標籤:net   das   details   use   url   pip   chunk   pypi   轉化   

灰階化

#coding:utf8import reimport urllibimport urllib2import requestsfrom PIL import Imageimport numpy as npdef downloads_pic(**kwargs):    pic_name = kwargs.get(‘pic_name‘, None)    url = ‘http://www.xxx.com/code.do‘    res = requests.get(url, stream=True)    with open(pic_path +‘test11.bmp‘, ‘wb‘) as f:        for chunk in res.iter_content(chunk_size=1024):            if chunk:  # filter out keep-alive new chunks                f.write(chunk)                f.flush()        f.close()pic_path=‘tmp\\‘downloads_pic()image = Image.open(‘tmp\\test.bmp‘)#image.show() #顯示圖片imgry = image.convert(‘L‘)  # 轉化為灰階圖 1:背景黑白

 

 

from PIL import Image
import numpy as np

install numpy

https://pypi.python.org/packages/2c/93/9556d25b1f23fd852fc2ddfcf68a4a62ba9e4ef83adabbf8921c80fce9a0/numpy-1.11.3-cp27-none-win_amd64.whl#md5=33bfb4c5f5608d3966a6600fa3d7623c

python -m pip install --upgrade pip

pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose


 Mark

http://www.cnblogs.com/yinxiangnan-charles/p/5928689.html

http://www.cnblogs.com/beer/p/5672678.html

http://blog.csdn.net/qq_30490125/article/details/51445390

python 驗證碼test

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.