📜  带有自定义函数的 python max - Python 代码示例

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

代码示例1
nums = [1,2,3,1,1,3,3,4,4,3,5] #list
counts = collections.Counter(nums) # create a dict of counts
#using counts.get() fun as custom function 
return max(counts.keys(), key=counts.get)