[英]Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'swim' is not defined
[英]Getting Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'filename' is not defined
运行包含此代码的脚本时:
print('Hello world')
我收到此错误消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'filename' is not defined
我已经仔细检查了我是否在当前的工作文件夹中( os.getcwd()
)。
有什么问题?
我认为最好使用命令提示符来运行 python 文件。
转到包含 python 文件的当前目录并打开命令提示符。 将您的 python 文件作为“python filename.py”运行。
那会很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.