Multi-dimension dictionary in configparser
Question: Is it possible to store a multi-dimensional dictionary (3 deep) using the
Python 'configparser' using indentions? The work-around is to split the key
values, but wanted to know if there was a clean way to import directly into a
dictionary.

**DOES NOT WORK - USING SUB-OPTION INDENTION IN CONFIGPARSER**

    
    
    
        [OPTIONS]
            [SUB-OPTION]
            option1 = value1
            option2 = value2
            option3 = value3
    
    

**WORKS - SPLITING USED ON SUB-OPTION VALUES**

    
    
    
        [OPTIONS]
        SUB-OPTION  = 'option1, value1',    
                      'option2, value2',
                      'option3, value3'
    
    

**DICTIONARY VALUES**

    
    
    
        dict['OPTIONS']['SUB-OPTION'] = {
            option1 : value1,
            option2 : value2,
            option3 : value3,
        }
    
    


Answer: ASAIK, there isn't 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())
    

