title: Translate a table to a hierarchical dictionary?
body: <p>I have a table of the form:</p>
  
  <pre><code>A1, B1, C1, (value)
  A1, B1, C1, (value)
  A1, B1, C2, (value)
  A1, B2, C1, (value)
  A1, B2, C1, (value)
  A1, B2, C2, (value)
  A1, B2, C2, (value)
  A2, B1, C1, (value)
  A2, B1, C1, (value)
  A2, B1, C2, (value)
  A2, B1, C2, (value)
  A2, B2, C1, (value)
  A2, B2, C1, (value)
  A2, B2, C2, (value)
  A2, B2, C2, (value)
  </code></pre>
  
  <p>I'd like to work with it in python as a dictionary, of form:</p>
  
  <pre><code>H = {
      'A1':{
          'B1':{
              'C1':[],'C2':[],'C3':[] },
          'B2':{
              'C1':[],'C2':[],'C3':[] },
          'B3':{
              'C1':[],'C2':[],'C3':[] }
      },
      'A2':{
          'B1':{
              'C1':[],'C2':[],'C3':[] },
          'B2':{
              'C1':[],'C2':[],'C3':[] },
          'B3':{
              'C1':[],'C2':[],'C3':[] }
      }
  }
  </code></pre>
  
  <p>So that <code>H[A][B][C]</code> yields a particular unique list of values.  For small dictionaries, I might just define the structure in advance as above, but I am looking for an efficient way to iterate over the table and build a dictionary, without specifying the dictionary keys ahead of time.</p>