Discuss / Python / NameError?

NameError?

Topic source

刘沐春风

#1 Created at ... [Delete] [Delete and Lock User]

C:\work>python hello.py Traceback (most recent call last): File "hello.py",;ine19,in<module> if name=='main': NameError: name'name' is not defined

命令行模式下运行hello.py模块显示这句话是神意思?哪位师兄给解释下

木禾米粥

#2 Created at ... [Delete] [Delete and Lock User]

__name__

前后各有两个下划线的

我也遇到这个问题,而且name还是这个问题,请问你解决了吗


  • 1

Reply