代码点读机 / Python / __doc__

__doc__ Python · 特殊属性

读取函数、类或模块的文档字符串。

怎么用

对象.__doc__

小例子

def f():
    '''这是说明'''
    pass
print(f.__doc__)

运行结果

这是说明

官方文档:https://docs.python.org/zh-cn/3/library/functions.html#help

在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Python全部词条