With Python, can I keep a persistent dictionary and modify it?

后端 未结 7 1340
孤城傲影
孤城傲影 2020-12-16 16:23

So, I want to store a dictionary in a persistent file. Is there a way to use regular dictionary methods to add, print, or delete entries from the dictionary in that file?

7条回答
  •  余生分开走
    2020-12-16 16:37

    If your keys (not necessarily the values) are strings, the shelve standard library module does what you want pretty seamlessly.

提交回复
热议问题