【发布时间】:2018-12-08 23:43:06
【问题描述】:
我想知道是否有可能,使用漂亮的汤,几行 html 行:
<tr id="12590559" class="">
<td>
<span class="he16-1 tip-top" title="Cracker"></span>
</td>
<td>
cracker.crc
</td>
在该示例中,我想提取 id 但标题信息使用:
soup = BeautifulSoup(lista.content, "lxml")
id = soup.find(attrs={"title": "Cracker"})
我可以得到
<span class="he16-1 tip-top" title="Cracker"></span>
但我也想获得id。我可以使用BeautifulSoup 来排几行吗?
【问题讨论】:
-
如果正确解决了您的问题,请将答案标记为已接受 :)
标签: python python-3.x beautifulsoup