gpt4 book ai didi

python - 如何让 python 在 Visual Studio Code MacOS 中运行

转载 作者:太空宇宙 更新时间:2023-11-03 20:12:31 24 4
gpt4 key购买 nike

我想通过 VisualStudioCode 在我的 Mac 上运行 python 2.17。但是我不断收到此错误消息。知道为什么吗?

我尝试将代码复制到新文件并重新启动 VCS。

Traceback (most recent call last):
File "/Users/Home/Documents/_Sue IT Polytech 2019/Software Development/LinkedInPyTutOct2019/Exercise Files/Chap03/03_05_begin.py", line 2, in <module>
name = input("What's your name? ")
File "<string>", line 1, in <module>
NameError: name 'Sue' is not defined
Suzannes-MBP:Exercise Files Home$

预期输出是继续执行任务的程序。程序询问一个名字,给出一个名字,然后应该会出现一条“详细”消息。

最佳答案

正如您所说,您正在使用 Python 2.x。

使用raw_input而不是input从用户处获取字符串。

关于python - 如何让 python 在 Visual Studio Code MacOS 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58637177/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com