Accessing JSON elements

前端 未结 5 1579
我寻月下人不归
我寻月下人不归 2020-11-30 23:19

I am getting the weather information from a URL.

weather = urllib2.urlopen(\'url\')
wjson = weather.read()

and what I am getting is:

5条回答
  •  执念已碎
    2020-12-01 00:02

    'temp_C' is a key inside dictionary that is inside a list that is inside a dictionary

    This way works:

    wjson['data']['current_condition'][0]['temp_C']
    >> '10'
    

提交回复
热议问题