0
HI我需要幫助,我的簡單編程是NameError,我的代碼:HI我需要幫助,我的簡單編程是NameError
class Televisao():
def __init__(self,boolean, channel):
self.channel = 2
self.boolean = False
def main():
tvhome =Televisao()
print tvhome.channel
if __name__== "__main__" :
main()
NameError: name 'tvhome' is not defined
請檢查你的代碼格式,並提供完整的錯誤回溯。但請注意,「Televisao」!=「televisao」'。 – jonrsharpe
看起來像你的意思是'tvhome = Televisao()'而不是'televisao()'沒有大寫't'。因此這似乎是無關緊要的,因爲它是一個錯字。 –