python帮助函数输出的标记语言?

2024-04-20 11:07:37 发布

您现在位置:Python中文网/ 问答频道 /正文

help(something)的输出是否遵循某种易于在html中格式化的标记语言?我知道pydoc -w [topic]但是有两个问题:

  • 风格的定制并不容易(http://bugs.python.org/issue10716)以及
  • pydoc -w某些主题失败(http://stackoverflow.com/a/10333615/1318686)你知道吗

下面是help('def')生成的一些示例输出。它具有其他标记语言的一些典型特征。例如,空格表示代码块,`表示内联代码,**表示突出显示。。。你知道吗

有什么想法吗?你知道吗

谢谢!你知道吗

Function definitions
********************

A function definition

Multiple decorators are applied in
nested fashion. For example, the following code:

   @f1(arg)
   @f2
   def func(): pass

just like a function defined by a lambda form.  The "``def``" form is
actually more powerful since it allows the execution of multiple
statements.

**Programmer's note:** Functions are first-class

Tags: the代码标记form语言httptopic风格