After installation, there will be a folder in the Programs folder called Python 2.4 (Enthought Edition). Since Python is an interpreted language, you can either run a script or run individual statements on from the Python interpreter. One of the ways to use the interpreter is to open the Python Shell by clicking on IDLE (Python GUI) in the Python 2.4 (Enthought Edition) folder. From this shell, you can execute individual lines of code.
IDLE should look similar to this:
Python 2.4.3 - Enthought Edition 1.0.0 (#69, Aug 2 2006, 12:09:59) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 1.1.3 ==== No Subprocess ====
>>>
You can run statements from the interpreter. For example, type print "Hello World", then hit enter:
>>> print "Hello World" Hello World
Now that you have the interpretter open, you can create a new Python script from the file menu. This file will be saved with a .py ending. You can run the file by clicking F5 or from the Run menu. After saving a file, you can edit it by right clicking the file and selecting "Edit with IDLE". Double clicking the file will cause it to be run by the interpreter, then immediately exit.
Here are two very basic example scripts.
To run these scripts, right click and download them. Next, right click the file and select Edit with IDLE. Finally, click F5 to run the script.
Note that python does not use semi-colons to mark the end of statement and that it does not use brackets. Instead of brackets, Python uses indentation.
If you ever need to halt a running program, use the key combination Control-C
You can learn more about a specific function, class, or module by using the help command. For example, you can see documentation about the NetworkX package from the interpreter.
>>> help(networkx)
Help on package networkx:
NAME
networkx
FILE
c:\python25\lib\site-packages\networkx\__init__.py
DESCRIPTION
NetworkX
========
NetworkX (NX) is a Python package for the creation, manipulation, and
study of the structure, dynamics, and functions of complex networks.
https://networkx.lanl.gov/
This help is abbreviated. Much more will appear in the interpeter
You can call help on individual classes and functions within classes such as:
>>> help(networkx.Graph) >>> help(networkx.Graph.add_node)
Many additional modules are included with the Python installation. To use these modules you must use the import statement in order to be able to use them. For example, you can import the NetworkX package by including this line at the top of a .py file or from the interpretter:
import networkx