开发者

How to extract data from JSON Object in Python? [duplicate]

This question already has answers here: How can I extract a single value from a nested data structure (such as from parsing JSON)? (5 answers) HTTP requests and JSON parsing in Python [duplicate] 开发者_如何学JAVA (8 answers) Closed 8 months ago.

I am trying to extract data from JSON Object which is returned from the api call for api.trends() [Tweepy] but I am not able to extract the data.

Can anyone give me an example of how to extract data from JSON object. I want to extract the data in tabular form.

Thanks in advance.


Once you run it though json.loads() it becomes normal Python objects. Simply index it as you would any dict or list.

>>> json.loads('{"foo": 42, "bar": "baz"}')['bar']
'baz'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜