|
|
Using Python on Willow
Python Information
Version: 2.2
Installation Directory: /usr/local/python2.2
Executable: /usr/local/python2.2/bin/python
Usage
Python can be run in either interactive or interpreted mode. In interactive mode, the user types code
directly into the python interface, and the python interpreter immediately executes the user's code at the end of each
line or block entered. In interpreted mode, the user first creates a program in a text editor, and then feeds the entire
program into the python interpreter, at which time it is executed as a whole.
To invoke the interactive mode, type:
/usr/local/python2.2/bin/python
To interpret a previously written program, type:
/usr/local/python2.2/bin/python my_program.py
Simple Example
This is a complete python program that will first add 2 + 2, print the result, and then print the numbers 0 to 9
on a single line:
#pythontest.py
# add 2 + 2
print "2 + 2 = ", 2 + 2
# print just an empty line
print
# display numbers 0 to 9
for number in range(10):
print number,
|
More Information about Python
Python Tutorial - Written by the creator of Python
Python (programming language) - Wikipedia article on Python
|