title: Python INI to Dictionary - Loop through all items in section
body: <p>I am a newbie to Python and just got started with reading Windows INI file into Python Dictionary object. This is the method that I follow</p>
  
  <pre><code>import ConfigParser
  
  class MyParser(ConfigParser.ConfigParser):
      def as_dict(self):
          d = dict(self._sections)
          for k in d:
              d[k] = dict(self._defaults, **d[k])
              d[k].pop('__name__', None)
          return d
  
  if __name__ == "__main__":
      f = MyParser()
      f.read("/DIRECTORY_TO/setup.ini")
      d = f.as_dict()
  </code></pre>
  
  <p>My INI file like any other Standard INI file looks like this</p>
  
  <pre><code>[A]
  Name = XYZ
  Age = 23
  [B]
  Name = DEF
  Age = 19
  </code></pre>
  
  <p>The file gets loaded and based on the len(d) I can see that items are getting loaded into the Dictionary object. Now how do I loop / iterate through all the items (key, value) in each section? This is only my 2nd day with Python so I am unable to figure this out.</p>
  
  <p>Thanks a ton,
  MM</p>