Multi-dimension dictionary in configparser

ASAIK, there is a nested configuration file in that format.

I suggest a json like config file:

{
 "OPTIONS": {
   "SUB-OPTIONS": {
     "option1" : value1,
     "option2" : value2,
     "option3" : value3,
   }
 }
}

Then in the code use:

from ast import literal_eval
with open("filename","r") as f:
 config = literal_eval(f.read())

Edit

Alternatively, you can use YAML (with PyYAML) as a great configuration file.

The following configuration file:

option1:
    suboption1:
        value1: hello
        value2: world
    suboption2:
        value1: foo
        value2: bar

Can be parsed using:

import yaml
with open(filepath, 'r') as f:
    conf = yaml.safe_load(f)

Then you can access the data as you would in a dict:

conf['option1']['suboption1']['value1']
>> 'hello'

config.ini

OPTIONS  = {"option1": "value1", "option2": "value2", "option3": "value3"}

Code:

import json
options = json.loads(conf['OPTIONS'])