根据上图的请求URL示例可知,我们需要调用的url为
https://free-api.heweather.net/s6/weather/forecast?...0]['daily_forecast']
print(result)
因为这里调用的API会返回7天的数据,所以会返回7组下图的数据。..."pres": "1013", # 大气压强
"sr": "06:37", # 日出时间
"ss": "17:43", # 日落时间...','天气状况','最高温','最低温','日出','日落']
for data in result:
date = data['date']
cond = data['cond_txt_d...', '天气状况', '最高温', '最低温', '日出', '日落']
with open('today_weather.csv', 'w', newline='')as f: