1、count()

描述:统计列表中指定元素的个数

参数:value  指定的元素

返回值:返回这个值在列表中的个数,若未找到则返回0

示例1:

l = ['knight','sky','xiaobai','xiaoxiaobai']
l1 = l.count('sky')
print(type(l1),l1)

输出结果:

<class 'int'> 1
View Code

相关文章:

  • 2021-12-03
  • 2021-10-26
  • 2022-01-04
  • 2022-12-23
  • 2021-10-24
  • 2021-12-26
  • 2021-08-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-10-29
  • 2021-11-01
  • 2022-02-02
相关资源
相似解决方案