在Python (2.7.6)idle运行时每次都弹出syntax error报错,然后就看到2.7.6的“7”被标注。 5
Python2.7.6(default,Nov102013,19:24:18)[MSCv.150032bit(Intel)]onwin32Type"copyright",...
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information. >>>
import urllib,re
>>> def a(url):
page=urllib2.urlopen(url)
html=page.read()
return html
>>> def getimg(html):
reg=r'src="(.+?\.jpg)"pic_ext'
imgre=re.compile(reg)
imglist=re.findall(imgre,html)
x=0
for i in imglist:
urllib2.urlretrieve(i,'%s.jpg'%x)
x=x+1
>>> html=a("http://tieba.baidu.com/p/2460150866")
>>> print getimg(html) 展开
Type "copyright", "credits" or "license()" for more information. >>>
import urllib,re
>>> def a(url):
page=urllib2.urlopen(url)
html=page.read()
return html
>>> def getimg(html):
reg=r'src="(.+?\.jpg)"pic_ext'
imgre=re.compile(reg)
imglist=re.findall(imgre,html)
x=0
for i in imglist:
urllib2.urlretrieve(i,'%s.jpg'%x)
x=x+1
>>> html=a("http://tieba.baidu.com/p/2460150866")
>>> print getimg(html) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询