我想知道我是否可以使用漂亮的汤,将 html 行排成几行:
<tr id="12590559" class="">
<td>
<span class="he16-1 tip-top" title="Cracker"></span>
</td>
<td>
cracker.crc
</td>
Run Code Online (Sandbox Code Playgroud)
在那个例子中,我想提取 id 但使用标题信息:
soup = BeautifulSoup(lista.content, "lxml")
id = soup.find(attrs={"title": "Cracker"})
Run Code Online (Sandbox Code Playgroud)
我可以得到
soup = BeautifulSoup(lista.content, "lxml")
id = soup.find(attrs={"title": "Cracker"})
Run Code Online (Sandbox Code Playgroud)
但我也想得到id. 我可以用BeautifulSoup来排列几条线吗?