返回顶部

__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'>
'''

 

posted @ 2019-08-06 18:47  Zcb0812  阅读(76)  评论(0编辑  收藏  举报