通过本文主要向大家介绍了python简单代码示例,python示例程序,python代码示例,python示例,python爬虫示例等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
def getImg(html,imgType):
reg = r'src="(.*?\.+'+imgType+'!slider)" '
imgre = re.compile(reg)
imgList = re.findall(imgre, html)
x=0
for imgurl in imgList:
print imgurl
urllib.urlretrieve(imgurl, '%s.%s' % (x, imgType))
x =x+1
html= getHTML("http://www.jb51.net")
getImg(html,'jpg')
</div>

