来源:蜘蛛抓取(WebSpider)
时间:2017-07-24 01:54
标签:
php提取标签内容img
python BeautifulSoup 抓取网页内指定内容
我的图书馆
python BeautifulSoup 抓取网页内指定内容
python&BeautifulSoup&抓取网页内指定内容
代码片段(1)
1.&[代码][Python]代码&&&&
?12345678910111213141516171819# _*_ coding:utf-8 _*_#xiaohei.python.seo.call.me:)#win+python2.7.ximport urllib2from bs4 import BeautifulSoupdef jd(url):&&&&page = urllib2.urlopen(url)&&&&html_doc = page.read()&&&&soup = BeautifulSoup(html_doc.decode('gb2312','ignore'))&&&&for i in soup.find_all('div', id="sortlist"):&&&&&&&&one = i.find_all('a')&&&&&&&&two = i.find_all('li')&&&&&&&&print ("%s %s" % (one,two))jd("/computer.html")
TA的最新馆藏
喜欢该文的人也喜欢160被浏览17843分享邀请回答0添加评论分享收藏感谢收起14被浏览3264分享邀请回答02 条评论分享收藏感谢收起