__doc__

__doc__用法

def fun1():
    """This is a fun1"""
    pass

class Debug:
    """This is a class for debugging"""
    def __init__(self):
        """
        This funtion only has one property
        """
        self.x = 5

print(fun1.__doc__)	# This is a fun2    
# debug
main = Debug()
print(main.__doc__)	# This is a class for debugging  
print(main.__init__.__doc__)	# This funtion only has one property
This is a fun2
This is a class for debugging

        This funtion only has one property
posted @ 2024-01-07 22:56  lxd670  阅读(3)  评论(0编辑  收藏  举报