请问我这样写为什么不行
class Person(object):
count = 0
def __init__(self,name):
self.count = self.count + 1
self.name = name
p1 = Person('Bob')
print Person.count
p2 = Person('Alice')
print Person.count
p3 = Person('Tim')
print Person.count
class Person(object):
count = 0
def __init__(self,name):
self.count = self.count + 1
self.name = name
p1 = Person('Bob')
print Person.count
p2 = Person('Alice')
print Person.count
p3 = Person('Tim')
print Person.count
2019-05-17
举报