title: Creating dynamic nested dictionary of counts
body: <p>I have a text file <code>abc.txt</code>:</p>
  
  <pre><code>abc/pqr/lmn/xyz:pass
  abc/pqr/lmn/bcd:pass
  </code></pre>
  
  <p>I need to parse these statements and output should be in nested dictionary as below:</p>
  
  <pre><code>{'abc':{'pqr':{'lmn':{'xyz':{'pass':1},{'bcd':{'pass':1}}}}}}
  </code></pre>
  
  <p>where 1 is <code>'pass'</code> count.</p>
  
  <p>I'm able to do as much as this:</p>
  
  <pre><code>import re
  
  d={}
  p=re.compile('[a-zA-z]+')
  for line in open('abc.txt'):
      for key in p.findall(line):
          d['key']={}
  </code></pre>