Reputation: 39
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. Can I hide the 1st line so I only see the output in the 2nd line?
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
Upvotes: 3
Views: 33508
Reputation: 1
Donwload code-runner extension in VsCode,
then unchecked Code-runner:Show Execution Message
in setting of
code-runner extension.
enter image description here
Upvotes: -2
Reputation: 498
If you use code-runner extension,
open settings.json (ctrl + shift + p then type settings.json) then add this
"code-runner.executorMap": {
"python": "<console clear> && <python or your python version> -u",
},
"code-runner.clearPreviousOutput": true,
"code-runner.showExecutionMessage": false,
"code-runner.runInTerminal": true,
In my case i replaced
<console clear> with clear (since i am on wsl)
&&
<python or your python version> with python3.10
Upvotes: 1
Reputation: 71
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
if you want to return back to showing full path just type prompt and press Enter.
Upvotes: 0
Reputation: 10354
launch.json
in the .vscode
folder, and "console":
sets the way the code debugging results are displayed.
"console": "internalConsole",
After setting it, the debugging result will be displayed in the "debug console" inside VSCode.
"console": "externalTerminal",
and the debugging results will be displayed in the "cmd" window outside VSCode. 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.Reference: console.
Upvotes: 3