你的分享就是我们的动力 ---﹥

python 抓取网页

时间:2014-11-07 13:23来源:www.chengxuyuans.com 点击:
#urllib2
wp = urllib2.urlopen(self.url)
content = wp.read();

pycurl

        	buf = cStringIO.StringIO()
         
        	c = pycurl.Curl()
        	c.setopt(c.URL,self.url)
        	c.setopt(c.WRITEFUNCTION, buf.write)
        	c.perform()
         	
        	content =  buf.getvalue()
        	buf.close()        
    
    
    	   
            jc = json.loads(content)

转载注明地址:http://www.chengxuyuans.com/Python/84256.html

推荐文章