Python len()方法
2019-03-15 10:18 更新
Python len()方法

描述
Python len() 方法返回字符串长度。
语法
len()方法语法:
len( s )
参数
- s:对象。
返回值
返回对象长度。
实例
以下实例展示了len()的使用方法:
>>>str = "w3cschool"
>>> len(str) # 字符串长度
9
>>> l = [1,2,3,4,5]
>>> len(l) # 列表元素个数
5
以上内容是否对您有帮助:
更多建议: