def dump(obj, file_name):
if file_name.endswith('.json'):
with open(file_name, 'w') as f:
f.write(jsonpickle.dumps(obj))
return
if isinstance(obj, np.ndarray):
np.save(file_name, obj)
return
# Using joblib instead of pickle because of http://bugs.python.org/issue11564
joblib.dump(obj, file_name, protocol=pickle.HIGHEST_PROTOCOL)
评论列表
文章目录