How to create a dict based on such a file?

Nicholas Devenish misnomer at gmail.com
Mon Feb 14 23:51:30 CET 2011


On 14/02/2011 19:25, Dan Stromberg wrote:
> pyparsing should be able to make pretty short work of exactly the
> format you want.
>
> FWIW, the creator of the many .ini format(s), Microsoft, no longer
> recommends using .ini files.

I don't know what Microsoft uses now, but it seemed their immediate 
successor was the windows registry, which wasn't exactly fun.

INI-style files are extremely simple, very easy to parse (if you don't 
have a handy parsing library for it, which is rare) and very 
human-readable and modifyable. *If* your configuration data doesn't get 
more complex than an optionally sectioned flat-file, then it can seem 
like the right tool for the job. Especially if you need people who 
aren't exactly programmers to be able to configure and understand the file.

As for JSON, another that it seems is often mentioned around such 
things; I like it, but find it a little verbose for such simple flat 
configuration files.



More information about the Python-list mailing list