【发布时间】:2022-02-02 02:47:49
【问题描述】:
我有以下html
<div class="1" style="">
text0
<span class="2">text1</span>
<div class="3" title="something" name="something1">
text2
<span class="small">text3</span>
</div>
</div>
我正在尝试使用 BeautifulSoup 提取 text0。
但是
div = soup.find_all("div", {"class":"1", "style":"").text.strip()
或
div = soup.find("div", {"class":"1", "style":"").get_text()
不工作。有什么想法吗????
【问题讨论】:
标签: python html python-3.x beautifulsoup tags