Reputation: 9726
I am new to python, and i need to read ini file with data lists:
list[] = 1
list[] = 2
list[] = 3
and files without sections. I know about ConfigParser module, i saw huge amount of hacks to make it wotk with those things, but i do not want to write all this bullshit in my code. I just want normal library that is able to do that itself.
Could you please advice some module, that is able to handle work with ini files please?
Upvotes: 0
Views: 435
Reputation: 11614
Because "INI"-File syntax has no standard, most libraries reinvent some common conventions. And IMHO they are all bad (especially ConfigParser). I propose to use JSON instead of INI-Files. If it's an interchange between different plattforms use the respective stdlibs to convert from "ini" to "json" and export it to python as json.
As metioned by Amadan in the comments below, YAML may even be better, but i suggested json, because it's supported in python's stdlib where yaml (afaik) isn't, at least in 2.x.
Upvotes: 3