6
>>> print(len.__doc__)
len(module, object)
Return the number of items of a sequence or mapping.
>>> len(os, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: len() takes exactly one argument (2 given)
注意兩個參數在文檔字符串的第一行。什麼是len的文檔字符串中的「module」?
你什麼時候將兩個參數傳遞給len
?文檔字符串是否不正確?我正在使用Python 3.4.0。
對我來說,'打印(LEN .__ DOC __)'打印** LEN(對象)序列的項目 歸還號碼或收集。** – falsetru 2014-10-28 13:28:44
@falsetru這很奇怪。你使用哪個版本的Python? – rightfold 2014-10-28 13:29:04
我使用Python 3.4.2 – falsetru 2014-10-28 13:29:20