python下载图片
import re import urllib.request def getHtml(url): page = urllib.request.urlopen(url) html = page.read() return str(html) def getImg(html): reg = r'src="(.+?\.jpg)" pic_ext' imgre = re.compile(reg) imglist = re.findall(imgre,html) return imglist html = getHtml("http://tieba.baidu.com/p/2460150866") print getImg(html)