1 | initial version |
It's possible to redirect sys.stdout
and sys.stderr
temporarily to files. See Example 10.9. Redirecting output from Mark Pilgrim's Dive into Python.
Note: Redirecting stdout will also send the Sage prompt sage:
to the output file. You can suppress most of the prompt with
sage.misc.interpreter.set_sage_prompt('')
. I don't know if it's also possible to remove the colon that IPython inserts.
And also by the way, you might find IPython's "magic" %logstart
and %logstop
commands somewhat useful. See %logstart?
for options.