On 4/12/2012 10:41 AM, Roy Smith wrote:
Is there a simple way to deep merge two dicts?  I'm looking for Perl's
Hash::Merge (http://search.cpan.org/~dmuey/Hash-Merge-0.12/Merge.pm)
in Python.

def dmerge(a, b) :
   for k in a :
        v = a[k]
        if isinstance(v, dict) and k in b:
            dmerge(v, b[k])
   a.update(b)
        
        

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to