Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python max key dictionary key getter

from operator import itemgetter

items = [
    {'a': 1, 'b': 99},
    {'a': 2, 'b': 88},
    {'a': 3, 'b': 77},
]

print(max(items, key=itemgetter('a')))
print(max(items, key=itemgetter('b')))
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #python #max #key #dictionary #key #getter
ADD COMMENT
Topic
Name
5+9 =