python 根据两个字段排序, 一个升序, 一个降序

from collections import Counter
c = Counter(input())
l=sorted(c.items(), key=lambda s:(-s[1], s[0]))
for i in l[:3]:
    print(' '.join(map(str, list(i))))
原文地址:https://www.cnblogs.com/TMatrix52/p/11408438.html