我试过:
for row in soup.find("tbody").find_all("tr"):
col = row.find_all("td")
date =col[0].text
revenue = col[1].text.replace("$", "").replace(",", "")
tesla_revenue = tesla_revenue.append({"Date":date, "Revenue":revenue}, ignore_index=True)
tesla_revenue.head()
这就是结果
结果显示了左边的表格,但我想在右边有一个,我应该怎么选择下一个tbody? (链接中有截图)
如果要选择第二个表(
<tbody>
标记),可以执行以下操作:相关问题 更多 >
编程相关推荐