Monday, 2 July 2012

Running Python


There are three different ways to start python :
1)    Interactive Interpreter:
You can enter python and start coding right away in the interactive interpreter by starting it from the command line. You can do this from Unix, DOS, or any other system which provides you a command-line interpreter or shell window.

$python                       #Unix/Linux
Or
Python %                    #Unix/Linux
Or
C:>python                   #Windows/DOS

Here is the list of all the available command line options:

–d                    provide debug output.
–o                    generate optimized bytecode (resulting in .pyo files)
–S                    do not run import site to look for python paths on startup
–v                    verbose output (detailed trace on import statements)
–X                    disable class-based built-in-exception; obsolete starting with version 1.6
–c cmd                        run Python script sent in as cmd string
File                  run Python script from given file.

2)    Script from the Command-line:
A python script can be executed at command line by invoking the interpreter on your application, as in the following:
$python   script.py                  #Unix/Linux
Or
Python %   script.py                #Unix/Linux
Or
C:>python    script.py             #Windows/DOS

3)    Integrated Development Environment:
You can use Python from a graphical user interface(GUI) environment as well. All you need is the GUI application on your system that supports Python.
·         Unix: IDLE is the very first Unix IDE for Python.
·         Windows: PythonWin is the first Windows interface for Python and is an IDE with a GUI.
·         Macintosh: The Macintosh version of Python is called MacPython .

No comments:

Post a Comment