Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coreypobrien/pyconfigini
Fork of https://bitbucket.org/maascamp/pyconfigini
https://github.com/coreypobrien/pyconfigini
Last synced: 14 days ago
JSON representation
Fork of https://bitbucket.org/maascamp/pyconfigini
- Host: GitHub
- URL: https://github.com/coreypobrien/pyconfigini
- Owner: coreypobrien
- Created: 2014-10-20T13:12:26.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-20T13:20:28.000Z (about 10 years ago)
- Last Synced: 2024-10-29T10:55:27.604Z (22 days ago)
- Language: Python
- Size: 113 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
README
======
pyconfigini is a .ini style config file parser modeled on [Zend_Config_Ini](http://framework.zend.com/manual/en/zend.config.adapters.ini.html).
Lines beginning with '#' are treated as comments.It supports section inheritance and uses the '.' character for namespacing values. E.g.
# This is a global value
global = True
[production]
database.host = db.example.com
database.port = 3306
database.user = prod
database.pass = prod_password[dev : production]
database.host = localhost
database.user = dev
database.pass = dev_passwordpyconfigini exposes one function `parse_ini` which takes 2 arguments: the path (relative or absoloute) of the config file to be parsed, and (optionally) the section to load.
If no section is specified it will load all sections and the section name must be used to access values. E.g.config = parse_ini('example.ini')
print config.global # prints (boolean) True
print config.production.database.hostvs.
config = parse_ini('example.ini', 'production')
print config.global # prints (boolean) True
print config.database.host