内容简介:Python 元组 len() 函数计算元组元素个数。
描述
语法
len()方法语法:
len(tuple1, tuple2)
参数
- tuple -- 要计算的元组。
返回值
函数返回元组元素个数。
实例
以下实例展示了 len()函数的使用方法:
#!/usr/bin/python tuple1, tuple2 = (123, 'xyz', 'zara'), (456, 'abc') print "First tuple length : ", len(tuple1); print "Second tuple length : ", len(tuple2);
以上实例输出结果如下:
First tuple length : 3 Second tuple length : 2
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Database Design and Implementation
Edward Sciore / Wiley / 2008-10-24 / 1261.00 元
* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!