Reputation: 43
new to Python and StackOverflow. Apologies if I miss any formalities.
I just created a one-line program to print Hello World but every time I run the program (using F5 or by going to Run->Start Debugging) the program runs and the panel at the bottom automatically switches to the Terminal window and the output gets displayed there and not in the Debug window. (Picture 1)
There are a lot of other things that get printed in the Terminal window which is why I want only the output to be printed in the Debug window. Also, that is how it is shown in the video of the course that I am doing (Picture 2).
print("Hello World")
Upvotes: 3
Views: 16084
Reputation: 10372
If you want to display the results in the debug console, you could open file launch.json
in folder .vscode
and add this setting: "console": "internalConsole",
. (or open the setting pattern next to the debug button to open launch.json
file. )
This is the complete content of my launch.json
file:
{ "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "internalConsole", } ] }
Then, through the test, the result is displayed in the debug console. like this:
Reference: Python debug configurations in VSCode.
Upvotes: 6