Object serialization - jenhaoyang/backend_blog GitHub Wiki

import pickle

mylist = ['dsafsaf', 'dfasdfa']

with open('mylist.pkl', 'wb') as f:
    pickle.dump(mylist, f)

with open('mylist.pkl', 'rb') as f:
    mynewlist = pickle.load(f)

print(mynewlist[1])

參考:
https://stackoverflow.com/a/25465148