时间:2021-07-01 10:21:17 帮助过:42人阅读
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.gxlcms.com")
getImg(html,'jpg')