python类可以任意添加属性
python类可以任意添加属性
class A(object):
def __init__(self):
self.name = "zhangsan"
self.age = 18
a1 = A()
print("类外打印:", a1.name)
print("类外打印:", a1.age)
A.score = 100
print("类外打印:", A.score)
输出

python类可以任意添加属性
class A(object):
def __init__(self):
self.name = "zhangsan"
self.age = 18
a1 = A()
print("类外打印:", a1.name)
print("类外打印:", a1.age)
A.score = 100
print("类外打印:", A.score)
输出
