#!/usr/bin/env python
#_*_coding:gb2312_*_
import re
import urllib
def getHtml(url):
page=urllib.urlopen(url)
html=page.read()
return html
def getImg(html):
reg=r'src=\"(.*\.jpg)'
image=re.compile(reg)
imglist=re.findall(image,html)
x=0
for imgurl in imglist:
urllib.urlretrieve(imgurl,'%s.jpg'%x)
print imgurl
x=x+1
html=getHtml('http://www.csdn.net')
getImg(html)