title: Using Configparser to create objects of a class?
body: <p>I'm a little stumped on how to do this.</p>
  <p>Let's say I have a employees.ini file that looks like this:</p>
  <pre><code>[amber]
  sex=female
  age=29
  location=usa
  income=60000
  debt=300
  
  [john]
  sex=male
  age=19
  location=usa
  income=19000
  debt=nan
  </code></pre>
  <p>I have a for loop to access each piece of information and assign to a variable.</p>
  <pre><code>from configparser import ConfigParser
  config=ConfigParser()
  config.read('employees.ini')
  for section in config.sections():
      name=section
      sex=config[section]['sex']
      age=config[section]['age']
      location=config[section]['location']
      income=config[section]['income']
      debt=config[section]['debt']
  </code></pre>
  <p>I also have a class where each section can be accepted as an object:</p>
  <pre><code>class Users:
      def __init__(self, name, sex, age, location, debt):
          self.__name=name
          self.__sex=sex
          self.__age=age
          self.__location=location
          self.__income=income
          self.__debt=debt
  
      def foo(self):
          do a thing
  
      def bar(self):
          do a different thing ...
  </code></pre>
  <p>My hope was to now be able to access amber.foo and john.bar. However, I'm struggling on how to pass the variables out of the for loop into the class before they are overwritten by the next iteration of the loop. I feel like I might be overthinking this one.</p>
  <p>My thought was this would make the code much more user friendly as a bulk of the code could be left untouched and only the .ini would need to be updated when a new user is needed.</p>
  <p>Thanks for any help you could give.</p>