如何在字典中寻找最大值

如何找到orange的price最大值?

fruits=[ { "code" : 1 , "Type" : "apple", "price" : "5"} ,
{ "code" : 2 , "Type" : "orange", "price" : "4"} ,
{ "code" : 3 , "Type" : "banana", "price" : "12"}
{ "code" : 4 , "Type" : "orange", "price" : "7"}
]

循环取值,然后用一个临时变量去比较是否比它大。大就替换

a=list(fruits.values())
print(max(a))

print(max((fruits[1]['price'],fruits[3]['price'])))