__init__ 错误
各位前辈,我写了一个很简单的语句,然后在运行的时候报了错误。错误信息是:Traceback (most recent call last):File "game.py", line 13, in <module>
ink('ink',10)
TypeError: __init__() takes exactly 2 arguments (3 given)
请问是什么问题啊?
下面是我写的:
1class inventory:
2 population=0
3 def __init__(self,name):
4 self.name=name
5 inventory.population+=1
6
7 class ink(inventory):
8 def __Init__(self,name,liter):
9 inventory.__init__(self,name)
10 self.liter=liter
11 print ('this is the {0},it contain {1:d} liter ink').format(self.name,self.lit er)
12
13 ink('ink',10)
14