Using recursion in nested dictionaries?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/13490963/how-to-flatten-a-nested-dictionary-in-python-2-7x">How to flatten a nested dictionary in python 2.7x</a>  </p>
</blockquote>



<p>If I have a dictionary:</p>

<pre><code>dictionaryname= { 'key1' : 'value1',
                     'key2' : 'value2',
                     'key3' : { 'key3a': 'value3a' },
                     'key4' : { 'key4a': { 'key4aa': 'value4aa',
                                           'key4ab': 'value4ab',
                                           'key4ac': 'value4ac'},
                                'key4b': 'value4b'}
                   }
</code></pre>

<p>How do I make it so that the result would be as follows:</p>

<pre><code>key1
value1
key2
value2
key3
key3a
value3a
...
</code></pre>

<p>I just have to print whole dictionary, not necessarily in the right order.</p>

<p>If I use:</p>

<pre><code>def print_all(dictionaryname):
    for i in dictionaryname:
        print i
</code></pre>

<p>I only get:</p>

<pre><code>key1
key2
key3
...
</code></pre>

<p>What should I do?</p>
