所有函数都具有内置属性__doc__,该属性返回函数源代码中定义的doc字符串。
def foo(): """ This is an example of how a doc_string looks like. This string gives useful information about the function being defined. """ pass print foo.__doc__
让我们看看打印时的样子
This is an example of how a doc_string looks like. This string gives useful information about the function being defined.