Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18874 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2012-01-12 13:24 +0100 |
| Last post | 2012-01-12 13:24 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: stable object serialization to text file Peter Otten <__peter__@web.de> - 2012-01-12 13:24 +0100
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2012-01-12 13:24 +0100 |
| Subject | Re: stable object serialization to text file |
| Message-ID | <mailman.4681.1326371074.27778.python-list@python.org> |
Máté Koch wrote: > I'm developing an app which stores the data in file system database. The > data in my case consists of large python objects, mostly dicts, containing > texts and numbers. The easiest way to dump and load them would be pickle, > but I have a problem with it: I want to keep the data in version control, > and I would like to use it as efficiently as possible. Is it possible to > force pickle to store the otherwise unordered (e.g. dictionary) data in a > kind of ordered way, so that if I dump a large dict, then change 1 tiny > thing in it and dump again, the diff of the former and the new file will > be minimal? > > If pickle is not the best choice for me, can you suggest anything else? > (If there isn't any solution for it so far, I will write the module of > course, but first I'd like to look around and make sure it hasn't been > created yet.) Have you considered json? http://docs.python.org/library/json.html The encoder features a sort_keys flag which might help.
Back to top | Article view | comp.lang.python
csiph-web