The World Wide Web, restored to 800 pixels of glory.
GeezerVison is showing www.runoob.com — Python 获取字典中最大值及对应的键
我要搞学习
字典字段的比较
获取字典中最大的值及其键:
prices = { 'A':123, 'B':450.1, 'C':12, 'E':444, } max_prices = max(zip(prices.values(), prices.keys())) print(max_prices) # (450.1, 'B')