显然我在这里错过了一些严重的事情。这是我的测试程序:
"""
Doc and nothing but doc
"""
class TestMe(object):
"""
class documentation goes here
"""
def testFunc(self):
"""
FunctionDoc Goes here
"""
print "Hello world"
if __name__ =="__main__":
t=TestMe()
t.testFunc()
我运行它并打印“Hello world”,当然。
但pydoc.py test.py
给出这个:
no Python documentation found for 'test.py'
显然我在这里遗漏了一些简单的东西,但是什么呢?
- 编辑 -
根据毗湿奴的建议,我添加了“print t.__doc__
”到文件的最后一行,现在运行该文件会给出以下结果:
Hello world
class documentation goes here
但pydoc仍然没有找到任何文档。
Pydoc 需要模块名称,而不是文件名。尝试pydoc test
.
如果参数中有斜杠,它将使用该参数作为文件名:pydoc ./test.py
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)