Python pickle package

pickle is a Python package for saving and loading a dict file.

usually the code like this:

For saving:

1
2
with open('dict_frame_score.pkl', 'wb') as f:
pickle.dump(dict_frame_scores, f, pickle.HIGHEST_PROTOCOL)

For loading:

1
2
with open("dict_frame_score.pkl", "rb") as f:
name_scores = pickle.load(f)

If you save several dicts using pickle.dump(), you should use the same amount of pickle.load(f) to load them.

Arch Linux journey 重装 Win10 笔记

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×