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'])
```
xingtai -学习天气预报
猜你喜欢
转载自blog.csdn.net/houlaos/article/details/106794586
今日推荐
周排行