嘿傢伙,所以我得到這個「TypeError:'int'對象不可調用」錯誤當我運行此代碼時,我做了一些研究,我認爲這是與我的變量命名?有人可以向我解釋什麼是錯的?'int'對象是不可調用的錯誤python
class account(object):
def set(self, bal):
self.balance = bal
def balance(self):
return balance
這是我的例子來看:
>>> a = account()
>>> a.set(50)
>>> a.balance()
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
a.balance()
TypeError: 'int' object is not callable
錯誤指向哪裏? – 2013-04-05 19:25:55