标题:__init__ 错误
取消只看楼主
spydanger
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2010-5-25
结帖率:50%
 问题点数:0 回复次数:0 
__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
搜索更多相关主题的帖子: init 
2010-06-08 21:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-309671-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.384851 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved