[英]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.