Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get the least value from a list of dictionaries

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: #list #dictionaries
ADD COMMENT
Topic
Name
8+8 =