Skip to main content

Process config file as a dict

Project description

What's it features
====================

* as simple as others
* you can access options according to dict syntax, just like x['name']['o'] =
1, x['name'].keys(), x['name'].values(), etc.
* you also can access options according to attr syntax, just like x.name.o = 1,
x.name.keys(), x.name.values(), etc. So the name must be Identifier or single word.
* you can save comments in it(but this feature is not tested so much)
* support multi level section, subsection name will just like: [firsub/secsub]
* can save config items order
* support multi data types: string, unicode, int, float, list/tuple, dict, etc,
you can save them to or regain them from config file
* can convert to dict '''new'''
* auto detect BOM of utf-8 file '''new'''
* It's a little module, just for my mind, so if you like, you could try it, but
if you don't like, just skip it, that's ok

Where can I download it?
==========================

* Visit the http://wiki.woodpecker.org.cn/moin/Dict4Ini site
* Download it from here attachment:dict4ini.py
* Dict4Ini also ships with UliPad, you can also download UliPad, and get it
from modules/dict4ini.py, that's the same.

What's new?
==============

* 2007/06/13 Version 0.9

* Thanks for Victor Stinner giving a output format patch, so you can define
your own output format "%s = %s" to anything you want, for example "%s=%s" or
"%s:%s". And Dict4Ini will auto remove '%s' from the fromat string, and the
strip() the rest of the string, then use it to split the key and value in Ini
file. For example, if you using "%s:%", Dict4Ini will get "%s:%s".replace('%s',
'').strip(), then use ':' to split the line.

* 2007/04/20 Version 0.8

* Add exception process when parsing file
* Add BOM detect

* 2007/04/19 Version 0.7

* Fix '\' escape

* 2006/03/21 Version 0.6

* Fix ordereditems bug.

* 2006/01/04 Version 0.5

* 2006/01/04

* Add ordereditems() method, so you can get the items according the ini file
definition

* 2005/12/30

* Support onelevel parameter, you can set it True, than only one level can be
used, so that the key can include section delimeter char in it.
* Support sectiondelimeter parmeter, you can set the section delimeter to
which you want

* 2005/12/12 Version 0.4

* Fixed a bug about "\" in option's value, thanks to Andreas Kaiser

* 2005/12/09 Version 0.3

* Adding dict() method, then you can change the DictIni object to dict type,
so you can really use it as a dict alternative

* 2005/10/16 Version 0.2

* Saving config items order
* Support float format

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page