__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