import urllib import string import re def getHtml(url): page=urllib.urlopen(url) html=page.read() return html def getPic(html): imgre=re.compile(r‘src=".+?\.jpg" data-big-img‘) imglist=re.findall(imgre,html) print imglist x=0 for imgurl in imglist: #src="http://pic.lvmama.com/img/v3/wechatcode.jpg"‘ imgurl=imgurl.replace(‘src="‘,‘‘) imgurl=imgurl.replace(‘" data-big-img‘,‘‘) urllib.urlretrieve(imgurl,‘%s.jpg‘ %x) x+=1 html=getHtml("http://ticket.lvmama.com/scenic-157197")
主要是 查看url
时间: 2024-10-09 11:15:04