Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you save the List to a file and restore it ? #3

Open
vsraptor opened this issue Dec 14, 2020 · 1 comment
Open

How do you save the List to a file and restore it ? #3

vsraptor opened this issue Dec 14, 2020 · 1 comment

Comments

@vsraptor
Copy link

Can you store the whole list to a file ... and unfreeze it later

@thegrymek
Copy link
Owner

Hi,

Could you write more details about it?

To store and restore entire list in single file you can use python module pickle and save it as usual file.

To store list:

import pickle

my_list = [1, 2, 3]

with open("my_file.pickle", "wb") as f:
    pickle.dump(my_list, f)

To restore list:

import pickle

with open("my_file.pickle", "rb") as f:
    my_list = pickle.load(my_list, f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants