I have a dictionary like this:
A = {'a':10, 'b':843, 'c': 39,.....}
I want to get the 5 maximum values of this dict and store a new dict with this. To get the maximum value I did:
max(A.iteritems(), key=operator.itemgetter(1))[0:]
Perhaps it is an easy task, but I am stuck on it for a long time. Please help!!!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…