> #add a key and setup for a sub-dictionary > if(D.has_key('a') == 0) > D['a'] = {} Another way to do this is with the dictionary's get method: D['a'] = D.get ('a', {}) Alex.