This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Ok, so i’m using an api that returns a dictionary that looks something like this:
random = {'random': 332, 'Id': 11, 'Mode': 'CLASSIC', 'Type': 'CUSTOM', 'participants': [{'Id': 100, 'Id': 14, '2Id': 4, 'cId': 1, 'IconId': 4245, 'Name': 'agaming83', 'bot': False, 'sId': 'F0IWXeoB', 'gCustomObjects': [], 'perks': {'perkIds': [8351, 8304, 8345, 8347, 8014, 9104, 5008, 5008, 5002], 'pStyle': 8300, 'pSubStyle': 8000}}], 'observers': {'encryptionKey': 'HNI11xmLmb6p o2uDNKE/oFJffZDNDvb'}, 'formId': 'A1', 'bChamp': [], 'StartTime': 0, 'Length': 0}
I want to get the Name agaming83 from this dict. I have tried things like:
Print(random['participants']['Name'])
or something like this
for key, value in random.items() :
print(key, value)
and nothing extracts the s pecific thing I want (the value agaming83). Any help would be awesome.
I am able to do something like this:
random2 = test[‘participants’]print(random2)
and am able to get a everything from the participants key, but I want to get just the specific value of agaming83 from the dict
If I made something confusing let me know and i’ll clarify
(side note please be gentle I am very new to python)
Subreddit
Post Details
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/shittyprogr...