官方文档,上面有源码链接
https://docs.python.org/3/library/collections.html
链接到 github 的,直接去搜也行,只不过可能没有从官方文档跳过去方便
https://github.com/python/cpython
只看源代码的话,本地也可以看,要 import 那个包,那个包自己的 repr 就写了
源码文件在哪
>>> import collections
>>> collections
<module 'collections' from '/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/collections/__init__.py'>
【 在 pqowie (日日科技) 的大作中提到: 】
: 比如from collections import Counter
: 输入help(counter)后可以看到很多说明文字,但怎么知道class Counter是怎么写出来的?Counter类的源代码能看到吗?
--
FROM 114.242.94.*