Answer the question
In order to leave comments, you need to log in
How to get certain information from a .json file?
I need to get the amount of Wins i.e. wins
When I write:
r = response.json()
print(r['lifeTimeStats'])
I get:
[{'key': 'Top 5s', 'value': '1309'}, {'key': ' Top 3s', 'value': '737'}, {'key': 'Top 6s', 'value': '1014'}, {'key': 'Top 10', 'value': '729'} , {'key': 'Top 12s', 'value': '1899'}, {'key': 'Top 25s', 'value': '1175'}, {'key': 'Score', 'value ': '1,306,255'}, {'key': 'Matches Played', 'value': '11229'}, {'key': 'Wins', 'value': '1698'}, {'key': ' Win%', '
Answer the question
In order to leave comments, you need to log in
for x in r['lifeTimeStats']:
if x.get('key') == 'Wins':
print(x.get('value'))
break
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question