Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python find max in list of dict by value

lst = [{'price': 99, 'barcode': '2342355'}, {'price': 88, 'barcode': '2345566'}]

maxPricedItem = max(lst, key=lambda x:x['price'])
minPricedItem = min(lst, key=lambda x:x['price'])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Python #find #max #list #dict
ADD COMMENT
Topic
Name
3+2 =