Python从入门到放弃完整教程目录:https://www.cnblogs.com/nickchen121/p/10718112.html

# lib/aa.py
class C:
    def __init__(self):
        self.name = 'SB'
# index.py

from lib.aa import C

obj = C()
  • __module__ 表示当前操作的对象在那个模块
print(obj.__module__)  # 输出 lib.aa,即:输出模块

二、__class__

  • __class__表示当前操作的对象的类是什么
print(obj.__class__)  # 输出 lib.aa.C,即:输出类

相关文章:

  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-06-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2021-05-16
  • 2022-12-23
  • 2021-07-17
相关资源
相似解决方案