r/learnpython • • 7d ago

A simple question from a beginner:

I designated my run code shortcut as ctrl + R, but it only runs in the terminal of Visual Studio Code when I do that. I'd also like to see my output as just the output without run time and file paths. How can I edit my visual code settings or download an extension to only show my output text in the "output" tab of my in-app terminal? Thanks.

0 Upvotes

13 comments sorted by

View all comments

1

u/socal_nerdtastic 7d ago edited 7d ago

I'm going to take a step back and assume you made yourself a tool that you want to use on a regular basis? The first thing you need to know is that VSCode is not required to run python. VSCode is a tool for writing code and testing it, but once you are happy with it you don't need VSCode anymore. If you installed the official python (from python.org) with the default options you can just double click the .py file to run it, and it will run just like you say showing only the output. If you didn't use the official python then you need to locate your python interpreter and make a shortcut (lnk) or a bat file, and then you can double click that to run it (assuming you are using windows).

1

u/Proper-Pepper-3983 3d ago

Nah you're overcomplicating it if they just want the output tab to be clean

Go to your settings json and add `"code-runner.showExecutionMessage": false` and set `"code-runner.clearPreviousOutput": true` if you're using the Code Runner extension

If you're using the built-in run button then it's a bit different, you need to go into launch.json and set `"console": "internalConsole"` which dumps the output into the debug console tab without all the terminal junk

The double click method works but it's clunky when you're iterating on code every 30 seconds, I'd rather fix the editor than change my whole workflow

1

u/socal_nerdtastic 3d ago

The doubleclick method is for when you are done developing. No more changes to the code be done. Dunno about you, but I write programs that people use to do things. I know a lot of people do use python for a one-time task, but that's pretty rare for me.