title: How should I parse a dict object?
body: <p>How should I define a function <code>parsedic()</code> which works like?</p>
  
  <pre><code>dic={0:0,
       1:{0:0,
          1:1,
          2:{0:0,},},
       2:{0:{1:0,
             0:{0:0}},},
       3:0}
  
  def parsedic(...):
      ...
  
  print parsedic(dic)
  </code></pre>
  
  <p><strong>results</strong>:</p>
  
  <pre class="lang-none prettyprint-override"><code>0-&gt;0
  3-&gt;0
  1.0-&gt;0
  1.1-&gt;1
  1.2.0-&gt;0
  2.0.0.0-&gt;0
  2.0.1-&gt;0
  </code></pre>
  
  <p>The type of the key of the dict can only be a number or string,
  and the value can only be a number, string, or dict.</p>
  
  <p>(To avoid misunderstandings, I deleted the words which showed how I've tried to solve this question for a long time.)</p>