[英]How to hide the file path displaying in Visual Studio Code's terminal
After I run my python code in the terminal, it displays a few paths in the 1st line and then the output of my code in the 2nd line.在终端中运行我的 python 代码后,它在第一行显示了一些路径,然后在第二行显示了我的代码 output。 Can I hide the 1st line so I only see the output in the 2nd line?我可以隐藏第一行以便在第二行只看到 output 吗?
C:\Users\Venyl\Desktop\VS CODE\Code 2020>C:/Users/Venyl/AppData/Local/Programs/Python/Python38-32/python.exe "c:/Users/Venyl/Desktop/VS CODE/Code 2020/print('lol').py"
hello world
launch.json
in the .vscode
folder, and "console":
sets the way the code debugging results are displayed.您可以在.vscode
文件夹中的launch.json
中使用以下设置,以及"console":
设置代码调试结果的显示方式。
"console": "internalConsole",
After setting it, the debugging result will be displayed in the "debug console" inside VSCode.设置好后,调试结果会显示在VSCode内部的“调试控制台”中。
"console": "externalTerminal",
and the debugging results will be displayed in the "cmd" window outside VSCode.并且调试结果会显示在 VSCode 外的“cmd”窗口中。 It also only displays the debugging results:它也只显示调试结果:
"console": "integratedTerminal",
it displays the results in the VSCode internal terminal, and displays the current environment and the path of the running file. VSCode默认使用: "console": "integratedTerminal",
它在VSCode内部终端显示结果,并显示当前环境和运行文件的路径。The above answer works for displaying the output as desired however if you want to hide the long path上面的答案适用于根据需要显示输出但是如果你想隐藏长路径
use prompt [text]使用提示 [文本]
For example, the following command sets "> (greater-than sign)" as prompt例如,以下命令将“>(大于号)”设置为提示
prompt $g提示 $g
if you want to return back to showing full path just type prompt and press Enter.如果您想返回显示完整路径,只需键入提示并按 Enter。
If you use code-runner extension,如果您使用代码运行器扩展,
open settings.json (ctrl + shift + p then type settings.json) then add this打开 settings.json (ctrl + shift + p 然后输入 settings.json) 然后添加这个
"code-runner.executorMap": {
"python": "<console clear> && <python or your python version> -u",
},
"code-runner.clearPreviousOutput": true,
"code-runner.showExecutionMessage": false,
"code-runner.runInTerminal": true,
Donwload code-runner extension in VsCode, then unchecked Code-runner:Show Execution Message
in setting of code-runner extension.在VsCode中下载code-runner extension,然后在code-runner extension的设置中取消勾选Code-runner:Show Execution Message
。 enter image description here在此处输入图像描述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.