2
計數器的最大可接這樣:如何找到一個反的第二個最大 - Python的
c = Counter()
c['foo'] = 124123
c['bar'] = 43
c['foofro'] =5676
c['barbar'] = 234
# This only prints the max key
print max(c), src_sense[max(c)]
# print the max key of the value
x = max(src_sense.iteritems(), key=operator.itemgetter(1))[0]
print x, src_sense[x]
,如果我想在遞減計數排序的計數器是什麼?
我該如何訪問第二個最大值,或第3個或第N個最大鍵?