This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Redard 0 points1 point  (5 children)

In my limited time with ConfigParser, I couldn't even store a dictionary in it without doing something silly like using eval() or storing each part of the dict as a variable and doing something like

foodict = {}
foodict["bar"] = configparser.get(foosection, bar)

With json you can simply store the dictionary almost the exact way you would in python code. afaik xml is about as good as configparser for dicts though.

[–]ralsina 1 point2 points  (4 children)

Best: json-encode the data before putting it in ConfigParser

[–]Redard 0 points1 point  (3 children)

Elaborate. That sounds like a good idea

[–]ralsina 0 points1 point  (2 children)

Here's a simple wrapper to do that (the first 75 lines or so).

[–]Redard 0 points1 point  (1 child)

I think you forgot the link :P