__doc__,__module__ ,__class__ ,
"模块的注释" class DemoClass: "类的注释" pass if __name__ == "__main__": import sys module = sys.modules[__name__] #获取当前模块对象 print(module.__doc__) demo = DemoClass() print(DemoClass.__doc__) print(demo.__module__) print(demo.__class__) ''' 输出: 模块的注释 类的注释 __main__ <class '__main__.DemoClass'> '''