【发布时间】:2016-04-12 22:44:08
【问题描述】:
使用 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
我找到了各种方法来提取页面的文本或 cmets,但没有办法做我正在寻找的事情。任何帮助将不胜感激。
【问题讨论】:
标签: python python-3.x web-scraping beautifulsoup