Skip to content
小飞侠
  • 首页
  • 小程序
  • uniapp
  • vue
  • APICloud
  • 其他
菜单

博客

  1. 首页>
  2. python>
  3. python统计列表中个元素出现各次数

python统计列表中个元素出现各次数

  • Post author:xfxia
  • Post published:2023年8月24日
  • Post category:python


from collections import Counter

Counter(a)

a = [9, 9, 3, 1, 1, 2]

result = Counter(a)

print(result)

或者

for x in a:
    if a.count(x)>1:
        print(x)

#



版权声明:本文为hengcall原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/hengcall/article/details/82387596

你可能也喜欢

Python的进击(上)– IC工程师的软实力

Python_OpenCV_灰度拉伸

云服务器 Python 环境配置(Pytorch,Yolo)

Micropython驱动ST7735显示中文(中文字体库)

Python实现IEEE754数据十六进值数与浮点数的转换 带socket加密传输的实例

【leetcode】4 Python实现两个排序数组的中位数

python自带静态web服务器搭建代码实现(一)

python turtle库制作可爱的假向日葵

mac:python安装路径

Python HTTP request 使用 retry 策略

python中怎么调用不同文件中的函数

python绘制一个简单的函数图像使用到了matplotlib库和numpy库

OpenCV画线圆椭圆多边形和以鼠标为画笔——python实现

python 笔记

3.Python数据容器之字典(dict)

python 求5的阶乘

一文搞懂什么是Python的metaclass

蓝桥杯试题及答案分享(Python版)

简单人脸识别的实现(基于Python与百度API接口)

全国计算机等级考试python题库

目录

  • APICloud (3)
  • golang (228)
  • java (8,236)
  • linux (4,002)
  • mysql (2,800)
  • php (1,070)
  • python (5,439)
  • solidity (25)
  • uniapp (235)
  • vue (2,463)
  • 其他 (88,233)
  • 小程序 (801)

文章归档

  • 2023年十二月 (1872)
  • 2023年十一月 (477)
  • 2023年十月 (17371)
  • 2023年九月 (44974)
  • 2023年八月 (26399)
  • 2023年七月 (14793)
  • 2023年六月 (1)
  • 2023年五月 (2186)
  • 2023年四月 (3838)
  • 2023年三月 (1544)
  • 2023年二月 (3)
  • 2023年一月 (4)
  • 2022年十二月 (3)
  • 2022年十一月 (36)
  • 2022年十月 (16)
  • 2022年九月 (8)
  • 2021年九月 (1)
  • 2020年九月 (6)
  • 2020年八月 (5)

标签

Aave (1) cosmos (6) defi (255) flag (27) gitee (1) github (1) golang (234) java (8234) linux命令 (82) List (1) map (1115) mysql (3093) npm (237) tendermint (6) uuid (43) vant (64) vmware (270) 区块链 (63) 合约 (37) 小程序版本更新 (3)
  • 首页
  • 小程序
  • uniapp
  • vue
  • APICloud
  • 其他
Copyright xfxia.com 鲁ICP备19024253号-2
关闭菜单