I am working in a VM
via PuTTY
.
Via terminal, I want to open, edit, and save a .py
file. How can I do it?
Thank you for your help.
The easiest way is to use vim
vim your_script.py
Edit your file and save it using :w or :x
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
Either do:
python3 -i pythonfile.py
At which you'll be entering the python editor after closing the program, or
Use a text editor like nano (since it's 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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With