json信息
{
"list":[
{
"dt": 1490791600,
"temp": {
"day": 58.26,
"min": 39.65,
"max": 67.37
}
"pressure": 999.65
}
{
"dt": 1480878000,
"temp": {
"day": 57.34,
"min": 40.11,
"max": 68.23
}
"pressure": 999.64
}
]
}
我的代码
json_obj = urllib2.urlopen(url)
data = json.load(json_obj)
for item in data['list']:
print item['temp']
输出
{u'day': 58.26, u'min': 39.65, u'max': 67.37}
{u'day': 57.34, u'min': 40.11, u'max': 68.23}
如何获取当天温度的信息(我的输出中u'day'
)?
如何为每天的温度分配一个唯一的变量ex:day1 = 58.26 day2 = 57.34?