python模块imghdr读图片后缀名
2015-09-24 17:17
459 查看
爬数据的时候常常遇到img标签的src中不包含图片的后缀名,如http://photos.prnewswire.com/prn/20100819/LA52539LOGO所示,
这时通过imghdr模块就能够把图片的后缀名读出来
例子:
这时通过imghdr模块就能够把图片的后缀名读出来
例子:
import urllib2 import imghdr url = 'http://photos.prnewswire.com/prn/20100819/LA52539LOGO' response = urllib2.urlopen(url) webpage = response.read() print imghdr.what('', webpage)
相关文章推荐
- 初学python
- 使用python 的paramiko制作堡垒机
- python matplotlib模块——绘制三维图形、三维数据散点图
- Python 3 抓取网页资源的 N 种方法
- 你可能不知道的python
- Python程序提示SyntaxError: invalid syntax错误
- Python爬取百度贴吧图片
- python:列表推导式,list comprehension
- python处理json
- [LeetCode]题解(python):018-4Sum
- Python 通过print_lol将数据保存到文件中
- python socket编程之select
- Json概述以及python对json的相关操作
- Python快速入门
- head first python读书笔记(十一)
- 猪猪侠那里弄的python递归脚本
- Python 网络爬虫 - 抓取糗事百科的段子(最新版)
- [LeetCode]题解(python):017-Letter Combinations of a Phone Number
- 【Python】BeautifulSoup文档(windows-pyhton2.7.10)
- python多进程(multiprocessing)