[Tutor] Writing to output file

Joseph J. Strout joe@strout.net
Thu, 25 Mar 1999 13:00:47 -0800


You just set sys.stdout to your file...

import sys

...
oldstdout = sys.stdout
sys.stdout = open("results.txt", 'w')
print "here's some data...."
...
sys.stdout = oldstdout


Cheers,
-- Joe
,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'