1 | initial version |
From your question I'm guessing you have installed Sage on your computer and you are running it in notebook mode.
It seems you program takes a long time to run, and outputs a lot of data. In such a case it is a good idea to output to a file rather than outputting to the screen, for two reasons:
printing to the screen takes time! Your program will run faster if it prints nothing to the screen.
in the program crashes, you at least get whatever was written to a file until then.
Writing to a file is simple in Python. See the following selection of links: lecture notes, ask-sage, stackoverflow.