count = 100 class Student(object): count = 0 def __init__(self,name): self.name = name print(count) #引用了外部变量 print(Student.count) #引用类的属性 Student.count += 1 #对类的属性进行操作
Sign in to make a reply
飞侠100