英文文档: len(s) Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set). 返回对象的长度 说明: 1. 返回对象的长度,参数可以是序列(比如字符串.字节数组.元…
英文文档: len(s) Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set). 说明: 1. 返回对象的长度,参数可以是序列(比如字符串.字节数组.元组.列表和ran…
len(s)用来判断对象的长度. 需要说明的是,整型,布尔等是没有长度这一说法的.字符串.字典.列表和元组都有长度. 例子: >>> len() Traceback (most recent call last): File , in <module> TypeError: object of type 'int' has no len() >>> len('hello') >>> len(True) Traceback (most rec…