User Tools

Site Tools


it:how-to_use_python_pickle

How-To use Python Pickle

Pickle

import pickle
 
my_data = [1, 5, 7, 8]
 
with open('pickle_test.pkl', 'wb') as output_file:
    pickle.dump(my_data, output_file)

Un-Pickle

import pickle
 
with open('pickle_test.pkl', 'rb') as input_file:
    my_read_data = pickle.load(input_file)
 
print(my_read_data)

Discussion

Enter your comment. Wiki syntax is allowed:
B X T C B
 
it/how-to_use_python_pickle.txt · Last modified: 2018/12/01 19:40 by pmay