Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
菜鸡求教, BeautifulSoup 处理百度百科数据问题
aeron
·
Mar 9, 2022
· 3108 views
This topic created in 1665 days ago, the information mentioned may be changed or developed.
怎么在处理百度百科数据的同时,保留文本内容的章节关系。百科的数据好像都是平铺并列的,没有层级结构,怎么处理才能输出包含层级关系的数据。
百科
层级
菜鸡
数据
2 replies
•
2022-03-10 12:40:05 +08:00
1
jeeyong
Mar 10, 2022
我粗看了一下...不能保证可以应用到所有百度百科内容上...
div[@data-pid=n]
遍历到没有元素为止, 遍历的时候检测是否有 data-index 属性.
data-index 是段落标题
其他就是文本内容...
可以满足你的需求吗?
2
aeron
OP
Mar 10, 2022 via iPhone
@
jeeyong
非常感谢,不好貌似不行,我试试其他方法吧
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
4496 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms ·
UTC 08:59
·
PVG 16:59
·
LAX 01:59
·
JFK 04:59
♥ Do have faith in what you're doing.
❯