作用
输出文件开头注释的内容
推广
1)momodule.py
"""This is the module docstring."""
def f(x):
"""This is the function docstring."""
return 2 * x
2)执行
>>> import mymodule
>>> mymodule.__doc__
'This is the module docstring.'
>>> mymodule.f.__doc__
'This is the function docstring.'
参考资料
print(doc) in Python 3 script
转载请注明原文地址: https://www.6miu.com/read-51137.html