嗨,我需要帮助我的简单编程是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
Tags:
更新: 似乎您已经在函数内部创建了实例,并从外部调用了它。你知道吗
更新: 另一个错误将会发生,正如你所说
相关问题 更多 >
编程相关推荐