查看python模块中的方法代码

时间:2015-09-29 12:26:40

标签: python python-2.7

我已经导入了一些python模块,我想查看一些模块方法的实现。我怎么能这样做?

我尝试inspect.getsource但是,我收到了这个错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 701, in getsource
    lines, lnum = getsourcelines(object)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 690, in getsourcelines
    lines, lnum = findsource(object)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 529, in findsource
    raise IOError('source code not available')
IOError: source code not available

0 个答案:

没有答案