【发布时间】:2021-01-27 11:23:10
【问题描述】:
我正在尝试使用 python 获取网站文章的纯文本。我听说过 BeautifulSoup 库,但是如何检索 html 页面中的特定标签?
这就是我所做的:
base_url = 'http://www.nytimes.com'
r = requests.get(base_url)
soup = BeautifulSoup(r.text, "html.parser")
【问题讨论】:
-
Stack Overflow 不是一个教程网站。你可以看看一些教程(比如realpython.com/beautiful-soup-web-scraper-python)和BeautifulSoup的文档。
标签: python beautifulsoup python-requests