内容简介:len() 方法返回列表元素个数。
描述
len() 方法返回列表元素个数。
语法
len()方法语法:
len(list)
参数
- list -- 要计算元素个数的列表。
返回值
返回列表元素个数。
实例
以下实例展示了 len()函数的使用方法:
#!/usr/bin/python list1, list2 = [123, 'xyz', 'zara'], [456, 'abc'] print "First list length : ", len(list1); print "Second list length : ", len(list2);
以上实例输出结果如下:
First list length : 3 Second lsit length : 2
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Text Processing in Python
David Mertz / Addison-Wesley Professional / 2003-6-12 / USD 54.99
Text Processing in Python describes techniques for manipulation of text using the Python programming language. At the broadest level, text processing is simply taking textual information and doing som......一起来看看 《Text Processing in Python》 这本书的介绍吧!