摘要: from collections import Counter a = [1, 1, 7, 3, 6, 2, 5, 4, 4, 3, 9, 4, 4, 1] #统计列表中重复次数最多的前N个元素N = 3 print(Counter(a).most_common(N)) #输出是[(4, 4), ( 阅读全文
posted @ 2019-03-04 10:22 coffee~ 阅读(4764) 评论(0) 推荐(0) 编辑