In [1]: class A: ...: NAME = 'A' # 类的直接下级作用域 叫做类变量 ...: def init(self, name): ...: self.name = name # 关联到实例的变量 叫做实例变量 ...: In [2]: a = A('a') In [3]: a.NAME Out[3]: 'A' In [4]: a.name Out[4]: 'a' In [5]: A.NAME Out[5]: 'A' In [6]: A.name ------------…