Ask Your Question

save and load

asked 2011-10-28 09:05:11 +0100

emiliocba gravatar image

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?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-10-28 09:59:21 +0100

kcrisman gravatar image

Nope, and great question! Here is how you do it.

sage: L = [n^2 for n in range(10^6)]
sage: len(L)
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)

Of course, this would work if you sent the file to another computer as well. See this part of the tutorial for more details.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-10-28 09:05:11 +0100

Seen: 4,821 times

Last updated: Oct 28 '11