I have a list of dicts as below:
lod = [
{'name': 'Tom', 'score': 60},
{'name': 'Tim', 'score': 70},
{'name': 'Tam', 'score': 80},
{'name': 'Tem', 'score': 90}
]
I want to get {'name': 'Tem', 'score':90}, but I can only do below:
max(x['score'] for x in lod)
This returns the value 90.
How can i get the whole dict?
source
share