python六十一: __module__属性

 tool.py如下

class util:
    def __init__(self):
        self.name = "util"

bmodule.py如下:

from aa.tool import util


u = util()
print(u.name)
print(u.__module__)  # u是来自哪个模块
print(u.__class__)   # u是由哪个类产生

猜你喜欢

转载自blog.csdn.net/m0_37564426/article/details/89981350