What is the simplest human readable configuration file format?
- by Juha
Current configuration file is as follows:
mainwindow.title = 'test'
mainwindow.position.x = 100
mainwindow.position.y = 200
mainwindow.button.label = 'apply'
mainwindow.button.size.x = 100
mainwindow.button.size.y = 30
logger.datarate = 100
logger.enable = True
logger.filename = './test.log'
This is read with python to a nested dictionary:
{
'mainwindow':{
'button':{
'label': {'value':'apply'},
...
},
'logger':{
datarate: {'value': 100},
enable: {'value': True},
filename: {'value': './test.log'}
},
...
}
Is there a better way of doing this? The idea is to get XML type of behavior and avoid XML as long as possible. The end user is assumed almost totally computer illiterate and basically uses notepad and copy-paste. Thus the python standard "header + variables" type is considered too difficult.
The dummy user edits the config file, able programmers handle the dictionaries. Nested dictionary is chosen for easy splitting (logger does not need or even cannot have/edit mainwindow parameters).