__doc__

发布时间 2024-01-07 22:58:55作者: lxd670

__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