如何获取python列表中的元素数量? [英] how to get the number of elements in a python list?

查看:124
本文介绍了如何获取python列表中的元素数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚接触python。我有以下代码:

I'm new to python. i've the following code:

liste = 'asdfasfasd:asdfafaergasde' # example, how the string looks like
liste = str.split(':');

if liste.count()>2 :
  print "NOT YET SUPPORTED!"

根据doc http://docs.python.org/library/stdtypes.html ,python可以只返回i的数字,其中s [i] == x。

According to the doc http://docs.python.org/library/stdtypes.html , python can just return number of i‘s for which s[i] == x .

有没有其他函数,可以给我列表中所有元素的数量?

Is there any other function, that can give me the number of all elements in the list?

提前感谢

推荐答案

这是 len()独立函数, if len(listen_addr)> 2:

这篇关于如何获取python列表中的元素数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆