Create/append nested dictionary inside a dictionary in Python? : <p>How to append a dictionary?<br>
I tried <code>maindict[a] = m</code> and <code>maindict[a][x] = n</code>. It didnt work, I get <code>TypeError: list indices must be integers or slices, not str</code></p>

<pre><code>maindict = 
{ 'a' : '',
  'b' : '',
...
}

m = 
{ 'x' : '', 
  'y' : ''}

n = 
{ 'l' : '', 
  'm' : ''}
</code></pre>

<p>tobe</p>

<pre><code>maindict =  { 'a' : { 'x' : { 'l' : '', 
  'm' : ''}, 'y' : ''},   
'b' : '', ... }
</code></pre>
