[IPython-user] capture run output to a file
John Hunter
jdh2358@gmail....
Mon Mar 26 15:42:43 CDT 2007
Is there a easyish, somewhat elegantish way to capture the output of a
"run somefile.py" command to a file or file handle?
I did this, but it wasd brutal and not what I wanted
import sys
fh = file('test.out', 'w')
saveout = sys.stdout
sys.stdout = fh
run test
sys.stdout = saveout
fh.close()
cat test.out
since the ascii control characters ended up in the output file and it
just didn't feel right...
JDH
More information about the IPython-user
mailing list