2
我知道這個標題看起來很熟悉一些舊問題,但我看過他們中的每一個,他們都沒有解決。 這裏是我的代碼:TypeError:init_animals()需要1個位置參數,但有2個被給出
class Island (object):E,W,R,P
def __init__(self, x, y):
self.init_animals(y)
def init_animals(y):
pass
isle = Island(x,y)
但是,我得到了以下錯誤:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __init__
TypeError: init_animals() takes 1 positional arguments but 2 were given
請告訴我,如果我有任何錯誤,我好這個困惑。 最好的問候
'def init_animals(self,y):' –