PYTHON WEATHER

时间:2023-03-08 16:53:56

小玩一下python强大的库文件,调api获取天气情况

#coding:utf-8

import urllib
import json content = urllib.urlopen('http://m.weather.com.cn/data/101040100.html').read()
s = json.loads(content)
print s["weatherinfo"]["city"]
print s["weatherinfo"]["weather2"]