How to open Python file to edit in Visual Studio Code from a terminal?

How can I open python file from the terminal of Ubuntu?

I mean, how can I open it and modify it on Visual Studio Code, instead of running it.

I tried the command:

python3 file.py

But that just runs the program.

1 Answer

The Visual Studio Code executable is called code, simply call it with your python file.

code file.py

Keep in mind that vscode is meant for managing whole projects, not just a single file.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like