python __doc__的作用
对于代码功能的注释,通过__doc__输出。
1 """ 2 3 this script does nothing, only to test the use of __doc__ 4 5 """ 6 7 if __name__ == "__main__": 8 print(__doc__)
运行输出
this function does nothing, only to test the use of __doc__
def test(): """ this function does nothing, only to test the use of __doc__ """ pass
test.__doc__
运行输出
this function does nothing, only to test the use of __doc__

浙公网安备 33010602011771号