If you want to save the output of a script, you can just use shell
redirection:
$ sage foo.sage > output.txt
or, to see the output and also put it in the file,
$ sage foo.sage | tee output.txt
You can also, from within your script, write strings to a file: see
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files.
From an interactive command-line session, see log_text, log_dvi, and
log_html, although I just tested log_text and for some reason it's not
putting the output into the log...log_dvi works, though.
Dan
--
--- Dan Drake <dr...@kaist.edu>
----- KAIST Department of Mathematical Sciences
------- http://mathsci.kaist.ac.kr/~drake