Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Can you run Python code on text in VS Code?
In VS Code, is it possible to run Python code on the text being edited?
I realize that I can save my text, create a .py
file, switch to a terminal (including VS Code's own terminal) and run the .py
file. However, some other editors like Gedit support running ad-hoc Python scripts to process the text without all the extra steps.
Does VS Code have a feature or extension like this?
1 answer
If your Python Interpreter is choosen inside of Vscode, you can normally find it on the bottom right of your screen.
This is the same Interpreter that the Terminal inside VSCode is using.
When your .py file is open and you have the Python Extension installed, you should have a small triangle on the Top right, this will execute the Python script in your open Editor.
Additionally you can click on the left of your Code and set "Breakpoints", those will help when you have to Debug your Code immensely.
1 comment thread