1
是否可以查看方法的工作方式?例如列表方法count()。 我有一個列表:任何方法的Python細節
li = [3, 5, 6, 7, 3, 3, 3]
當我鍵入
print li.count(3)
的ouptut將4.我如何能看到這個魔術發生代碼? 命令幫助(list.count)給出的短信息不足:
>>> help(list.count)
Help on method_descriptor:
count(...)
L.count(value) -> integer -- return number of occurrences of value
'help(list.count)',請閱讀[文檔](https://docs.python.org/2/tutorial/datastructures.html#more-on-lists)或看[source]( https://github.com/python/cpython/blob/master/Objects/listobject.c#L2173)。 –
您是否試過Google搜索Python的源代碼? – TigerhawkT3
是的,我試圖在Google中找到這段代碼。但我沒有成功。 – goodgrief