from collections import Counter

# 列表
l_one = [1709020621, 1709020621, 1770603107, 1770603105, 1770603106, 1770603105, 1709020621]
# 把列表换成字典统计
c = Counter(l_one)
print(c)
k = c.most_common(len(c))  # 找出全部元素从大到小的元素频率以及对应的次数。
# 转化成列表形式,列表每一项又是元祖。
print(k)
# 数据按照从大到小的顺序输出
for i in k:
    print(str(i[0]) + " " + str(i[1]))

Python中Counter统计数据输出具体办法

相关文章:

  • 2022-12-23
  • 2021-12-01
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-14
  • 2021-11-23
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2021-06-07
相关资源
相似解决方案