There are many solutions to serialize a small dictionary: json.loads/json.dumps, pickle, shelve, ujson, or e
I would consider HDF5 for this. It has several advantages:
/foo/bar).It does have some disadvantages too:
h5py).You can think of HDF5 as a way to store values (scalars or N-dimensional arrays) inside a hierarchy inside a single file (or indeed multiple such files). The biggest problem with just storing your values in a single disk file would be that you'd overwhelm some filesystems; you can think of HDF5 as a filesystem within a file which won't fall down when you put a million values in one "directory."