小编LAN*_*ark的帖子

使用BeautifulSoup在HTML注释之间提取文本

使用Python 3和BeautifulSoup 4,我希望能够从HTML页面中提取仅由其上方的注释描绘的文本。一个例子:

<\!--UNIQUE COMMENT-->
I would like to get this text
<\!--SECOND UNIQUE COMMENT-->
I would also like to find this text
Run Code Online (Sandbox Code Playgroud)

我找到了多种方法来提取页面的文本或评论,但没有办法完成我要寻找的事情。任何帮助将不胜感激。

python beautifulsoup web-scraping python-3.x

4
推荐指数
1
解决办法
4601
查看次数

标签 统计

beautifulsoup ×1

python ×1

python-3.x ×1

web-scraping ×1