我使用Jupyter笔记本上的BeautifulSoup解析这个网站(http://www.jepoc.or.jp/hydro/index.php?_w=usData&_x=areashow3)的HTML数据。我只需要表中的数据(标题和值)
但是,解析的soup对象似乎只显示来自表头的值,而缺少所有表值项(例如数值)。来自<tr class = "rowOdd">
和<tr class = "rowEven">
的数据丢失
以下是我编写的代码:
import requests
r = requests.get("http://www.jepoc.or.jp/hydro/index.php?_w=usData&_x=areashow3")
print(len(r.text))
from bs4 import BeautifulSoup
soup = BeautifulSoup(r.text,"html5")
soup
尝试将所有内容打印到文件中,或者将代码末尾的soup改为
相关问题 更多 >
编程相关推荐