2024-06-28 19:27:03 发布
网友
我知道你可以做something.__doc___甚至inspect.getdoc(something)。但是,我希望以字符串形式检索完整的help()显示。换句话说,当你做help(something)的时候,整个事情都会发生。注意inspect.getdoc(inspect)如何检索显示内容的一小部分,而不是在解释器中检索内容的一小部分。这可能吗
something.__doc___
inspect.getdoc(something)
help(something)
inspect.getdoc(inspect)
根据this guide,定义docstring应该使help()函数可以使用它。我自己也测试过,它确实有效
help()
我使用的docstring格式(指南也碰巧使用)如下所示:
""" This is a description of the function :param name_of_param: what the parameter is for :return: what the function returns """
根据this guide,定义docstring应该使
help()
函数可以使用它。我自己也测试过,它确实有效我使用的docstring格式(指南也碰巧使用)如下所示:
相关问题 更多 >
编程相关推荐