📜  Python 按值在 dict 列表中查找最大值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:55.688000             🧑  作者: Mango

代码示例1
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'])