Python Pydoc没有看到docstring?
很明显我错过了一些重要的事情。这是我的测试程序:Python Pydoc没有看到docstring?,python,pydoc,Python,Pydoc,很明显我错过了一些重要的事情。这是我的测试程序: """ Doc and nothing but doc """ class TestMe(object): """ class documentation goes here """ def testFunc(self): """ FunctionDoc Goes here """ print "Hello world" if __name__ =
"""
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()
我运行它,它会打印“你好,世界”,纳奇。
但是pydoc.py test.py
给出了:
no Python documentation found for 'test.py'
很明显,我在这里遗漏了一些简单的东西,但是什么呢
--编辑--
根据毗瑟奴的建议,我在文件的最后一行添加了“print t t.\uuuuuu doc\uuuuuuuu
”,现在运行该文件给出了以下信息:
Hello world
class documentation goes here
但是pydoc仍然找不到任何文档。pydoc需要模块名,而不是文件名。尝试
pydoc测试
如果参数中有斜杠,它将使用该参数作为文件名:
pydoc./test.py
您是否尝试了TestMe.\uuuuu doc\uuuu
?您是否尝试了此处发布的解决方案?是的,这就是我在发布这篇文章之前看到的。为什么我觉得我上面的测试脚本是正确的。宾果!我知道这一定很简单。