Re: Compare two nested dictionaries

2010-07-26 Thread John Nagle
On 7/25/2010 8:03 AM, targetsmart wrote: Hi, I am trying to compare two nested dictionaries, I want to know what is the exact difference between them. d1 = {'a' : 1, 'b' : 2, 'c': 3 } d2 = {'a' : 1, 'b' : 3, 'd': 4 } diff = dict(s

Re: Compare two nested dictionaries

2010-07-25 Thread Raymond Hettinger
[targetsmart] > > I am trying to compare two nested dictionaries, I want to know what is > > the exact difference between them. I tried this solution [Steven D'Aprano] > If you want to know the difference between two dictionaries, you have to > consider: > > (1) Ke

Re: Compare two nested dictionaries

2010-07-25 Thread News123
Hi, On 07/25/2010 06:21 PM, Steven D'Aprano wrote: > On Sun, 25 Jul 2010 08:03:06 -0700, targetsmart wrote: > >> Hi, >> I am trying to compare two nested dictionaries, I want to know what is >> the exact difference between them. I tried this solution >>

Re: Compare two nested dictionaries

2010-07-25 Thread Steven D'Aprano
On Sun, 25 Jul 2010 08:03:06 -0700, targetsmart wrote: > Hi, > I am trying to compare two nested dictionaries, I want to know what is > the exact difference between them. I tried this solution > > ... > s1 = set(result1) > s2 = set(result2) > p

Compare two nested dictionaries

2010-07-25 Thread targetsmart
Hi, I am trying to compare two nested dictionaries, I want to know what is the exact difference between them. I tried this solution ... s1 = set(result1) s2 = set(result2) print s1 - s2 but it doesn't seem show any difference, but assert result1 == result2 fails