class Student(object): count = 0 def __init__(self, name): Student.count += 1 self.name = name print(Student("tom1").count) print(Student("tom2").count) print(Student("tom3").count) print(Student("tom4").count) print(Student("tom5").count) print(Student("tom6").count) print(Student("tom7").count) print(Student("tom8").count) #结果 1 2 3 4 5 6 7 8
Sign in to make a reply
三心二易我不会