python3_统计计数
(13条消息) python中统计计数的几种方法_Python热爱者的博客-CSDN博客_python 连续数字统计
1、count()
list1 = [123,"one","two","three","one","three","two","four",123] count_123 = list1.count(123) print("123 元素个数:" , count_123) #123 元素个数: 2 count_one = list1.count('one') print("one 元素个数:" , count_one) #one 元素个数: 2 count_two = list1.count('two') print("two 元素个数:" , count_two) #two 元素个数: 2 count_three = list1.count('three') print("three 元素个数:" , count_three) #three 元素个数: 2 count_four = list1.count('four') print("four 元素个数:" , count_four) #four 元素个数: 1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术