Python & JSON Phrasing issues -
I am trying to read the twitchAPI JSON phrase I am trying to read The API here is part of JSON: etc., it wants to collect multiple How do I < Code> can get the name items? This is my current effort; [data] [name '] [' as follows'] ['user']] for data in data > < Code> data ['low'] is a Then, Then after receiving the name of the user, you Then the answer is: or ==== I can not comment on the answer ======= The second answer is not correct because there is no names
{"_links": {"next": "Https://api.twitch.tv/kraken/channels/test_user/follows?direction=DESC&limit=25&offset=25", "self": "Https://api.twitch.tv/kraken/channels/test_user / Follows? Direction = DESC & amp; limit = 25 & amp; offset = 0 "}," _total ": 336," Low ": [{" _links ": {" self ":" https://api.twitch.tv/kraken / Users / test_follower / follows / channels / test_user "}," created_at ":" 2014-07-24 T20: 21: 10Z "," Usage Narta ": {" _id ": 00000001," _links ": {" self ":" https://api.twitch.tv/kraken/users/test_follower "}," bio ": zero," created ":" "Test_follower", "test_follower", "name": "test_follower", "type": "user", "updated_at": "2014-07-" 24 T 20: 20: 29Z "}}, names values list , you can not use ['user'] to get the element in this list . You must use a loop or data ['lower'] [0] to get the
{"_links": {"self": "https: // api .twitch.tv / kraken / users / test_follower / follows / channels / test_user "}," created_at ":" 2014-07-24 T20: 21: 10Z "," user ": {" _id ": 00000001 , "_links": {"self": "https://api.twitch.tv/kraken/users/test_follower"}, "bio": tap, "created": "2014-07-05T17: 27: 45Z "Display_name": "test_follower", "logo": "name": "test_follower", "type": "user", "updated_at": "2014-07-24 T 20: 20: 29Z"}} < / Code> data ['lower'] [0] ['user'] will get you
"user": {"_id": 00000001, "_Links": {"self": "https://api.twitch.tv/kraken/users/test_follower "Test_follower", "logo": "name": "test_follower", "type": "test_follower", "bio": tap, "created": "2014-07-05T17: 27: 45Z", "Display_name": "User", "updated_at": "2014-07-24 T 20: 20: 29Z"} [name] Add. printed D ata ['lower'] [0] ['user'] ['name'] print [data ['user'] ['name'] for data in data ['lower']] for Loop is not correct even if you change the data ['] [' user '] to data [' lower '] [0] [' user '] , because < Code> data ['name'] is not valid. 'name' data ['as follows']
Comments
Post a Comment