title: Multi dimensional dictionary in python
body: <pre><code>#!/usr/bin/python
  
  import sys
  from collections import defaultdict
  from collections import Counter
  
  new_dic_defaultdict = defaultdict(dict)
  #new_dic_defaultdict = defaultdict(int)
  
  file="SMSCDR_POSTPAID_150901235000_10.84.0.29_AS.log"
  
  fp=open(file,"r")
  str = fp.readlines();
  
  for line in str:
          array = line.split('|')
          system_id = array[55]
          Origin = array[12]
          TIME = array[0]
          message_id = array[62]
          new_dic_defaultdict[Origin][system_id] = new_dic_defaultdict[Origin].setdefault(system_id, 0) + 1;
  
  print new_dic_defaultdict
  </code></pre>
  
  <p>Here I can write two dimensional directory. If I add third dimension its not working.</p>
  
  <pre><code>Ex: new_dic_defaultdict[Origin][system_id][message_id] = new_dic_defaultdict[Origin][system_id].setdefault(message_id, 0) + 1;
  </code></pre>
  
  <p>How to solve this</p>