python,获取字典中出现次数最多的项

from collections import Counter
def get_mst_freq_item(list_data):
    x1 = dict(Counter(list_data))
    dic1SortList = sorted(x1.items(),key = lambda x:x[1],reverse = True)
    print (dic1SortList)
    return dic1SortList[0][0]

 

你可能感兴趣的:(Python及其库使用相关)