[EMAIL PROTECTED] wrote:
I find that in at least some cases, pickling is hideously inefficient,
taking on the order of 10 times as much space as a different format.
In my case I knew the resulting file would be quite small (3K at the
max), and even then I zipped it anyway. (Not for any reason, but I was
already using zipfile for the level sets so why not.)
I wasn't pickling image data or anything like that.
If you want to store a dictionary, a quick way to do that is to use text,
writing a key:value pair to each line and ignoring lines that start with
"#".
lines = text.split("\n")
key, value = line.split(":")
key = key.rstrip()
value = value.lstrip()
dict[key] = value
Yes, but in my case the keys (and possibly values) are strings which
could contain a ":" or almost any other character, and maybe something
else which wouldn't translate well to text. So pickling is much easier.
Aaron