title: Use ConfigParser with different variable types in Python
body: <p>I am trying to use <code>ConfigParser</code> in the following situation. I am running some code after which i have an object with several attributes. I pick out some of these attributes and write them to a <code>.ini</code> file with <code>configparser</code>. This works fine and my <code>.ini</code> file looks something like this.</p>
  
  <pre><code>[Section]
  path = "D:\\"
  number = 10.0
  boolean = False
  </code></pre>
  
  <p>Then with some other script I want to read the file and add the items as attributes to another object (self) using.</p>
  
  <pre><code>parser.read('file.ini')
  self.__dict__.update(dict(parser.items("Section")))
  </code></pre>
  
  <p>This fails because all values are read as strings by configparser and now all attributes are strings. <code>parser.items("Section")</code> looks like this:</p>
  
  <pre><code> [('path', '"D:\\"'), ('number', '10.0'), ('boolean', 'False')]
  </code></pre>
  
  <p>Now I could go and specify the floats, integers, and booleans by their keys and use the corresponding methods <code>parser.getfloat</code>, <code>getint</code>, and <code>getboolean</code> to get the right python types out. However, that means making an extra list of keys and a loop to get them for each data type, which i don't want. Furthermore, even the path is now double quoted and i need to start removing quotes.</p>
  
  <p>This behavior makes <code>ConfigParser</code> almost completely worthless to me and I am doubting if I am using it correctly an if <code>ConfigParser</code> is the best option for my goal, which is simply to write object attributes to a file and at a later time read the file and add the parameters to a new object as attributes. Can I use <code>ConfigParser</code> for this effectively? Or should I start looking for a different method?</p>