import requests
pc = requests.get("http://t.weather.sojson.com/api/weather/city/101050703")
print(pc.text)
shuju = pc.json()
print(shuju)
# 天气预报:日期 湿度 温度 天气 城市
print("时间:"+shuju['time'])
print("城市:"+shuju['cityInfo']['city'])
print("温度:"+shuju['data']['wendu'])
print("湿度:"+shuju['data']['shidu'])
print("天气:"+shuju['data']['forecast'][0]['type'])
```
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交