Accessing JSON elements

前端 未结 5 1581
我寻月下人不归
我寻月下人不归 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:05

    Just for more one option...You can do it this way too:

    MYJSON = {
        'username': 'gula_gut',
        'pics': '/0/myfavourite.jpeg',
        'id': '1'
    }
    
    #changing username
    MYJSON['username'] = 'calixto'
    print(MYJSON['username'])
    

    I hope this can help.

提交回复
热议问题