📜  python collections Counter按键排序 - Python代码示例

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

代码示例1
# Just use sorted()
from collections import Counter
counter = Counter({'A': 10, 'C': 5, 'H': 7})
counter.most_common()
>>>[('A', 10), ('H', 7), ('C', 5)]
sorted(counter.items())
>>>[('A', 10), ('C', 5), ('H', 7)]