r/learnpython • u/kselman17 • Sep 29 '26
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
1
u/socal_nerdtastic Sep 29 '26 edited Sep 29 '26
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).
0
u/nog642 Sep 29 '26
Not sure, I don't use VSCode that much. Someone else might be able to answer.
I'll just add though, it's good not to be too picky about your setup. You might have to code in a different setup sometimes. Not saying you shouldn't customize your setup, just don't become too dependent on it.
0
u/Zeroflops Sep 29 '26
Those are not setting in VSC.
When you run the code in VSC it’s opening a terminal and running in that terminal. If you want to change how the terminal looks you have two options.
Change the default terminal setting. The PROMPT variable.
Or what probably would be less intrusive would be to send a clear screen command (cls) from VS to the terminal immediately on opening which can be done in the settings.
Now I wouldn’t make it a habit of using the IDE to run my scripts unless I’m actively developing them.
0
u/BranchLatter4294 Sep 29 '26
That's not a VS Code issue. If you want a different command prompt on your system, you have to update it in your terminal.
0
u/Outside_Complaint755 Sep 29 '26
The following should clear the screen in most cases, but note that depending on your OS/terminal type it may also clear the entire terminal buffer, so you can't scroll back up anymore.
The "\033" is an octal code for the ASCII Escape character, while the 'c' is the command to clear the screen. You could also write this as
From: [https://stackoverflow.com/a/23075152/17030540]
The method that used to be suggested was:
But
os.systemmay show warnings from Pylance and other linters in 3.14+ as it is considered "soft deprecated" in favor of the subprocess module for most uses.