VS代码运行前一个文件而不是当前文件

时间:2020-07-29 08:22:12

标签: python html visual-studio-code ide

I clicked run on python file, but it keep on opening the previous html file.

我在vs代码中单击了从python文件运行,但终端未运行(通常在之前运行),而vs代码将继续打开作为前一个文件打开的html文件。

3 个答案:

答案 0 :(得分:0)

如果您需要临时解决方案,则可以将要运行的代码(如在CMD中)写入终端。

请确保您在正确的目录中,然后键入:python name_of_code.py,它应该运行它。

例如。

C:\Users\User\Desktop\Python\My_Dicrectory> python my_code.py

答案 1 :(得分:0)

因为您选择了Launch:index

enter image description here

选择Python:Current File将解决您的问题:

enter image description here

答案 2 :(得分:0)

我找到了答案:将.vscode文件夹添加到其中包含Json文件的同一文件夹中。它会继续覆盖文件夹中的当前文件。谢谢大家