Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient method to store Python dictionary on disk?

What is the most efficient method to store a Python dictionary on the disk? The only methods I know of right now are plain-text and the pickle module.

Edit: Sorry for not being very clear. By efficient I meant fastest execution speed. The dictionary will contain mutable objects that will hold information to be parsed and modified.

like image 598
linkmaster03 Avatar asked Jan 14 '10 21:01

linkmaster03


1 Answers

shelve is pretty nice as well

or this persistent dictionary recipe

for a convenient method that keeps your objects synchronized with storage, there's the ORM SQLAlchemy for python

if you just need a way to store string values by some key, theres the dbm.ndbm and dbm.gnu modules.

if you need a hyper efficient, distributed key value cache, something like memcached for python...

like image 181
jspcal Avatar answered Nov 04 '22 17:11

jspcal