to save the program output to a file called out.txt
python program.py > out.txt
From a helpful Python 2.3 quick reference 
python[w] [-dEhiOQStuUvVWxX?] [-c command| scriptFile | - ] [args]
(pythonw does not open a terminal/console; python does)
Invocation Options Option Effect
-d Output parser debugging information (also PYTHONDEBUG=x)
-E Ignore environment variables (such as PYTHONPATH)
-h Print a help message and exit (formerly -?)
-i Inspect interactively after running script (also PYTHONINSPECT=x) and force prompts, even if stdin appears not to be a terminal.
-O Optimize generated bytecode (also PYTHONOPTIMIZE=x). Asserts are suppressed.
-OO Remove doc-strings in addition to the -O optimizations.
-Q arg Division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew
-S Don't perform import site on initialization.
-t Issue warnings about inconsistent tab usage (-tt: issue errors).
-u Unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x).
-U Force Python to interpret all string literals as Unicode literals.
-v Verbose (trace import statements) (also PYTHONVERBOSE=x).
-V Print the Python version number and exit.
-W arg Warning control (arg is action:message:category:module:lineno)
-x Skip first line of source, allowing use of non-unix Forms of #!cmd
-X Disable class based built-in exceptions (for backward compatibility management of exceptions)
-c command Specify the command to execute (see next section). This terminates the option list (following options are passed as arguments to the command).
scriptFile The name of a python file (.py) to execute. Read from stdin.
- Program read from stdin (default; interactive mode if a tty).
args Passed to script or command (in sys.argv[1:])
If no scriptFile or command, Python enters interactive mode.