1. Home
  2. Computing & Technology
  3. Python

Executing a Python Program: Shell or File?

By Al Lukaszewski, About.com

2 of 4

Python's Live Interpreter: Execution as a Shell Game

Assuming you have installed Python, you can open a [link url=http://python.about.com/od/programmingglossary/g/defshell.htm]terminal or shell prompt[/link]. With the terminal open, type 'python' and press the 'Enter' key. You will immediately be transported into the Python live intepreter; your screen will probably look similar to this:

al@osprey:~$ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Now you can enter your program keeping in mind one thing. Because everything is read in real-time, loops iterate immediately unless they are part of a function or class. So programming in the live environment takes some mental planning.

2 of 4

Explore Python

More from About.com

  1. Home
  2. Computing & Technology
  3. Python

©2008 About.com, a part of The New York Times Company.

All rights reserved.