python使用md5处理下载图片
2015-04-30 23:48
531 查看
import urllib2 import hashlib opener = urllib2.build_opener() req = opener.open("http://avatar.csdn.net/E/5/5/2_sdjtwenzhihao.jpg") meta = req.info() file_size = int(meta.getheaders("Content-Length")[0]) content_type = meta.getheaders('Content-Type')[0].split(';')[0] print file_size, content_type #D3E373E8E47E785CC2C0997E3D1A4BBC #d3e373e8e47e785cc2c0997e3d1a4bbc md5=hashlib.md5(req.read()).hexdigest() print(md5) #save the file #open("2_sdjtwenzhihao.jpg", 'wb').write(req.read())
相关文章推荐
- 使用python处理RGBA格式的透明图片的粘贴
- 在python中可以使用urllib方便的实现图片和flash下载
- python处理图片之PIL模块简单使用
- 使用python处理没有被Web用到的图片
- python成长日记1:使用python访问网站,下载图片
- 使用Python下载Bing图片(代码)
- Python:使用Scrapy框架的ImagesPipeline下载图片如何保持原图片名称呢?
- python中使用urllib下载网站图片
- python中使用网络爬虫下载图片
- 使用简易Python爬虫下载百度贴吧图片
- Python宝典第八、九章:Python多媒体编程及使用PIL处理图片
- python使用PIL处理图片的一些收获和经验
- 使用python进行图像处理-调整图片大小
- 使用python将远程图片下载到本地
- 使用Python的urllib2模块处理url和图片的技巧两则
- 使用Python的urllib2模块处理url和图片的技巧两则
- Python图片处理库Wand的简单使用
- 使用python进行图像处理-调整图片大小
- 在Python中使用PIL模块对图片进行高斯模糊处理的教程
- 在Python中使用PIL模块对图片进行高斯模糊处理的教程