我使用的数据可以在这里找到-JSON Information
我正在使用此代码读取当前数据,但结果对我来说是陌生的,我不知道如何使用它:
import requests
site='http://www.bom.gov.au/fwo/IDN60801/IDN60801.95896.json'
r=requests.get(site)
print r.json()
这输出了一个庞大的字典??我不知道怎么做,但我想从这个JSON站点检索的是第一个“air\u temp”值。你知道吗
我相信这并不难,我只是个n00b
。你知道吗
谢谢你的帮助!你知道吗
以下是一些示例输出:
{
u'observations':{
u'header':[
{
u'state_time_zone':u'NSW',
u'time_zone':u'EDT',
u'main_ID':u'IDN60800',
u'product_name':u'Weather Observations',
u'state':u'New South Wales',
u'refresh_message': u'Issued at 6:02 pm EDT Monday 30 January 2017',
u'ID':u'IDN60801',
u'name':u'Albury'
}
],
u'notice':[
{
u'copyright_url': u'http://www.bom.gov.au/other/copyright.shtml',
u'disclaimer_url': u'http://www.bom.gov.au/other/disclaimer.shtml',
u'copyright':u'Copyright Commonwealth of Australia 2017,
Bureau of Meteorology. For more information see: http: //www.bom.gov.au/other/copyright.shtml http://www.bom.gov.au/other/disclaimer.shtml',
u'feedback_url': u'http://www.bom.gov.au/other/feedback'
}
],
u'data':[
{
u'swell_period':None,
u'wind_dir':u'SW',
u'lat':-36.1,
u'cloud_oktas':2,
u'gust_kt':16,
u'history_product':u'IDN60801',
u'local_date_time_full':u'20170130180000',
u'cloud':u'Mostly clear',
u'press_msl':1006.8,
u'cloud_type':u'-',
u'wind_spd_kmh':30,
u'lon':147.0,
u'swell_height':None,
u'wmo':95896,
u'press_qnh':1007.6,
u'weather':u'-',
u'wind_spd_kt':16,
u'rain_trace':u'-',
u'aifstime_utc':u'20170130070000',
u'delta_t':13.1,
u'press_tend':u'-',
u'rel_hum':24,
u'local_date_time': u'30/06:00 pm',
u'press':1006.8,
u'vis_km':u'47',
u'sea_state':u'-',
u'air_temp':32.2,
u'name':u'Albury',
u'cloud_base_m':2500,
u'cloud_type_id':None,
u'gust_kmh':30,
u'dewpt':9.1,
u'swell_dir_worded':u'-',
u'sort_order':0,
u'apparent_t':26.3
},
{
u'swell_period':None,
u'wind_dir':u'WSW',
u'lat':-36.1,
u'cloud_oktas':None,
u'gust_kt':25,
u'history_product':u'IDN60801',
u'local_date_time_full':u'20170130174300',
u'cloud':u'-',
u'press_msl':1006.7,
u'cloud_type':u'-',
u'wind_spd_kmh':28,
u'lon':147.0,
u'swell_height':None,
u'wmo':95896,
u'press_qnh':1007.5,
u'weather':u'-',
u'wind_spd_kt':15,
u'rain_trace':u'0.0',
u'aifstime_utc':u'20170130064300',
u'delta_t':13.4,
u'press_tend':u'-',
u'rel_hum':23,
u'local_date_time': u'30/05:43 pm',
u'press':1006.7,
u'vis_km':u'10',
u'sea_state':u'-',
u'air_temp':32.4,
u'name':u'Albury',
u'cloud_base_m':None,
u'cloud_type_id':None,
u'gust_kmh':46,
u'dewpt':8.6,
u'swell_dir_worded':u'-',
u'sort_order':1,
u'apparent_t':26.8
},
看看pythondictionary docs。你知道吗
提取所有温度:
只是第一个温度:
相关问题 更多 >
编程相关推荐