Ask Your Question
1

save and load

asked 13 years ago

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?

Thanks.-.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 13 years ago

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)
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 for more details.

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 5,423 times

Last updated: Oct 28 '11