title: List of dictionaries, in a dictionary - in Python
body: <p>I have a case where I need to construct following structure <strong>programmatically</strong> (yes I am aware of .setdefault and defaultdict but I can not get what I want)</p>
  
  <p>I basically need a dictionary, with a dictionary of dictionaries created within the loop.
  At the beginning the structure is completely blank.</p>
  
  <p>structure sample (please note, I want to create an array that has this structure in the code!)</p>
  
  <pre><code>RULE = {
       'hard_failure': {
          4514 : {
             'f_expr' = 'ABC',
             'c_expr' = 'XF0',
       }
      }
     }
  </code></pre>
  
  <p>pseudo code that needs to create this:</p>
  
  <pre><code>...
  self.rules = {}
  for row in rows:
       a = 'hard_failure'
       b = row[0] # 4514
       c = row[1] # ABC
       d = row[2] # XF0
       # Universe collapse right after
       self.rules = ????
  ...   
  </code></pre>
  
  <p>The code above is obviously not working since I dont know how to do it!</p>