![图片[1]-python中len是什么意思-uusu优素-乐高,模型,3d打印,编程](http://uusucn.zbbe.cn/wp-content/uploads/2024/01/5dd60108e0a36374.jpg)
Python中的len()函数
1:作用:返回字符串、列表、字典、元组等长度 2:语法:len(str) 3:参数:str:要计算的字符串、列表、字典、元组等 4:返回值:字符串、列表、字典、元组等元素的长度
5:实例
5.1、计算字符串的长度:
>>>s="hellogoodboydoiido" >>>len(s) 21
5.2、计算列表的元素个数:
>>>l=['h','e','l','l','o'] >>>len(l) 5原文来自:https://www.py.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END



















































暂无评论内容