store data
import pickle
import os
log_save_path = './log/'
log_name = "acc"
if not os.path.exists(log_save_path):
os.makedirs(log_save_path)
with open(log_save_path + log_name, 'wb') as f:
pickle.dump(acc, f)
read data
import pickle
import os
log_save_path = './log/'
log_name = "acc"
# read a dict and put it into acc
acc = pickle.load(open('2018-04-23-13-35acc','rb'))
# transfer dict into items, it looks like (key1, value1), (key2, value2)
items = list(acc.items())
# form keys and values
# sometimes we need a vector of keys and values
keys, values = tuple(zip(*items))