class employees:
emp_count = 0
def _init_(self, name, age):
self.name = name
self.age = age
employees.emp_count += 1
def displaycounts(self):
print "total counts is %d" % employee.emp_count
def displaydetails(self):
print "Name :", self.name, ",age:", self.age
obj = employees("krishna",4000)
obj1 = employees("shashi",10000)
obj3 = employees
obj.displaydetails()
obj1.displaydetails()
obj3.displaycounts()
回溯(最后一次调用):文件“C:/Python27/dd”,第 14 行,在 obj = employees("krishna",4000) 类型错误:此构造函数不接受任何参数