ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 28 Oct 2011 02:59:21 -0500save and loadhttp://ask.sagemath.org/question/8039/save-and-load/I have an algorithm which has a list of size 10^6 as output. I would like to run this program in one fast computer and then to upload this list and work in my compute. Can I do this? Have I to save the list as text?
Thanks.-.Fri, 28 Oct 2011 02:05:11 -0500http://ask.sagemath.org/question/8039/save-and-load/Answer by kcrisman for <p>I have an algorithm which has a list of size 10^6 as output. I would like to run this program in one fast computer and then to upload this list and work in my compute. Can I do this? Have I to save the list as text?</p>
<p>Thanks.-.</p>
http://ask.sagemath.org/question/8039/save-and-load/?answer=12830#post-id-12830Nope, and great question! Here is how you do it.
sage: L = [n^2 for n in range(10^6)]
sage: len(L)
1000000
sage: save(L,'my_long_list')
Now I quit Sage, and restart, and...
----------------------------------------------------------------------
| Sage Version 4.7.1, Release Date: 2011-08-11 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: L = load('my_long_list.sobj')
sage: len(L)
1000000
Of course, this would work if you sent the file to another computer as well. See [this part of the tutorial](http://www.sagemath.org/doc/tutorial/interactive_shell.html#saving-and-loading-individual-objects) for more details.Fri, 28 Oct 2011 02:59:21 -0500http://ask.sagemath.org/question/8039/save-and-load/?answer=12830#post-id-12830