How Do I Write a Python Script in Linux Terminal?
Contents

How do I write Python in Linux terminal?

Open a terminal window and type ‘python’ (without the quotes). This opens python in interactive mode. While this mode is good for initial learning, you may prefer to use a text editor (like Gedit, Vim or Emacs) to write your code. As long as you save it with the .

How do I create a python file in Linux?

Write Your Python Script

To write in the vim editor, press i to switch to insert mode. Write the best python script in the world. Press esc to leave the editing mode. Write the command :wq to save and quite the vim editor ( w for write and q for quit ).

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest