我正在尝试解析
<td height="16" class="listtable_1"><a href="http://steamcommunity.com/profiles/76561198134729239" target="_blank">76561198134729239</a></td>
对于 76561198134729239。我不知道该怎么做。我试过的:
import requests
from lxml import html
from bs4 import BeautifulSoup
r = requests.get("http://ppm.rep.tf/index.php?p=banlist&page=154")
content = r.content
soup = BeautifulSoup(content, "html.parser")
element = soup.find("td",
{
"class":"listtable_1",
"target":"_blank"
})
print(element.text)
原文由 user6665922 发布,翻译遵循 CC BY-SA 4.0 许可协议
该 HTML 中有许多这样的条目。要获得所有这些,您可以使用以下内容:
这将返回: