command line – How to edit a py file from terminal?

command line – How to edit a py file from terminal?

The easiest way is to use vim

vim your_script.py

Edit your file and save it using :w or 😡

You can also use emacs or nano

You also have to enter a command like i to get into insert mode. Then hit esc and :wq to save and quit. If you are using terminal often it may be helpful to have a cheat sheet

command line – How to edit a py file from terminal?

Either do:

python3 -i pythonfile.py

At which youll be entering the python editor after closing the program, or

Use a text editor like nano (since its installed by default with most operating systems), or emacs, which also is a great terminal text editor.

nano pythonfile.py

emacs pythonfile.py -nw

(-nw is a non-gui mode)

Leave a Reply

Your email address will not be published. Required fields are marked *