Python Config Files with Lists and Dictionaries
November 16, 2014
A common problem with configuration files is that they only allow simple values like strings, integers, doubles. It’s not uncommon to want to include more complex values such as a list or dictionary in your config. The most elegant approach I’ve seen for doing this in python is to make use of the json library to parse the values. First I’ll load an example config file using python’s SafeConfigParser. Typically your config would be in a separate file, however for the purposes of this blog post I’ll use a multi-line string. ...