📜  python 计数器最不常见 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:07.446000             🧑  作者: Mango

代码示例2
import collections
c = collections.Counter(a=1, b=2, c=3)
n = 2

print c.most_common()[:-n-1:-1]Output[('a', 1), ('b', 2)]