vscode一直输出与我的第一行代码相同的内容。

huangapple go评论64阅读模式
英文:

vscode keeps giving the same output from my first line of code

问题

如何配置Visual Studio Code
VScode一直输出相同的结果,从我的第一行代码开始

我创建了一个新的Python文件hello.py
我输入以下代码

print("hello")

输出是

hello

但是当我输入另一段代码

print("Hello World!")

输出仍然是相同的

hello

在这里输入图片描述

英文:

How do I configure Visual Studio Code
VScode keeps giving same output from my first line of code

I create new Python file hello.py
I type the following code

print("hello")

the output is

hello

but when I type another code

print("Hello World!")

the output is still the same

hello

enter image description here

答案1

得分: 2

问题在于你没有保存文件。如果你想在进行更改时自动保存文件,可以在 文件 > 自动保存 下点击自动保存功能,正如Hamidou在另一个回答中提到的。

英文:

As Hamidou mentioned in another answer, the problem is because you did not save the file. If you want to save the file whenever you make changes, you can turn on the auto save function by clicking auto save under File> auto save

答案2

得分: 1

根据您提供的图像,您没有保存您对文件所做的更改。您可以看到文件名顶部有一个白色的圆圈,所以只需使用CTRL + S保存更改,一切都应该没问题。

英文:

According to the image you provided, you didnt save the changes you made to file. You can see that with that white circle on top of the file name. So just save the changes with CTRL + S and everything should be fine

答案3

得分: 1

很显然,您在修改文件后没有保存它,文件名旁边的白色点表示了这一信息。

按下<kbd>Ctrl</kbd>+<kbd>S</kbd>以保存文件,然后执行脚本。或者添加以下设置以启用自动保存。

    "files.autoSave": "afterDelay",

此外,您正在使用Code Runner来执行代码,这并不推荐。如果您仍然想使用它,以下设置可以在运行代码之前保存脚本(仅适用于Code Runner)。

    "code-runner.saveFileBeforeRun": true,
英文:

Obviously you didn't save the file after modifying it, and the white dot next to the file name indicates this information.

vscode一直输出与我的第一行代码相同的内容。

Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save the file, then execute the script.
Or add the following setting to enable autosave.

    &quot;files.autoSave&quot;: &quot;afterDelay&quot;,

Also you are using Code Runner to execute code, which is not recommended. If you still want to use it, the following setting save the script before running the code (only for Code Runner).

    &quot;code-runner.saveFileBeforeRun&quot;: true,

huangapple
  • 本文由 发表于 2023年7月10日 14:45:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76651263.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定