#-*- coding:utf-8 -*-#python 2.7#XiaoDeng#http://tieba.baidu.com/p/2460150866#标签操作
from bs4 importBeautifulSoupimporturllib.requestimportre#如果是网址,可以用这个办法来读取网页#html_doc = "http://tieba.baidu.com/p/2460150866"#req = urllib.request.Request(html_doc)#webpage = urllib.request.urlopen(req)#html = webpage.read()
html="""
The Dormouse's storyThe Dormouse's story
Once upon a time there were three little sisters; and their names were
,
Lacie and
Tillie;
Lacie
and they lived at the bottom of a well.
个人资料
- 博客等级:
- 博客积分:0
- 博客访问:3,971
- 关注人气:0
- 获赠金笔:0支
- 赠出金笔:0支
- 荣誉徽章:
更多>>
...
"""soup= BeautifulSoup(html, 'html.parser') #文档对象#类名为xxx而且文本内容为hahaha的div
for k in soup.find_all('div',class_='atcTit_more'):#,string='更多'
print(k)#
更多>>
最后
以上就是含糊音响最近收集整理的关于python soup提取叶子标签_python3用BeautifulSoup抓取div标签的全部内容,更多相关python内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复