暂时只能想到这样的,结果是排序后的键列表.
d = {'a':3,'c':4,'b':3,'d':2,'f':4,'e':2}
result = []
keys = sorted(d,key=lambda k:d[k])
for k in keys:
if not result:
result.append(k)
elif d[k] == d[result[-1]] and k < result[-1]:
result.insert(len(result) - 1,k)
else:
result.append(k)
print result