我只想阅读美国宇航局网页上的“每日太阳辐射水平”一栏。我该怎么办?这是我的密码:
# Horizontal radiation values (kwh/m**2)
import urllib.parse
import html5lib
import pandas as pd
url = "https://eosweb.larc.nasa.gov/cgi-bin/sse/retscreen.cgi?email=rets%40nrcan.gc.ca&step=1&lat=49.4&lon=7.3&submit=Submit"
params = {'lat':a,'lon':b}
url_parts = list(urllib.parse.urlparse(url))
query = dict(urllib.parse.parse_qsl(url_parts[4]))
query.update(params)
url_parts[4] = urllib.parse.urlencode(query)
print(urllib.parse.urlunparse(url_parts))
webresult = pd.read_html(urllib.parse.urlunparse(url_parts))
webresult[3]
它只显示完整的表格。你知道吗
使用
BeautifulSoup
可以很容易地做到这一点。代码注释中给出了解释。你知道吗相关问题 更多 >
编程相关推荐