有没有更快更有效的方法来保存 python 字典?

Is there a faster and efficient way to save a python dictionary?

每次键值更改(或添加新键时),我都会使用 pickle 保存字典。我假设 pickle 保存了所有数据,包括未更改的键和值。有没有办法在密钥更改时有选择地腌制数据?更像是 git 所做的,即仅保存已更改的内容。

我觉得 pickle 不再符合您的要求。看看 Amin 建议的 Pickle Alternatives。

另一种可能性是基于 sqlite 的键值存储: