brad wrote:
I want to compare two dicts that should have identical info just in a different data structure. The first dict's contents look like this. It is authoritative... I know for sure it has the correct key value pairs:

{'001' : '01'}

The second dict's contents are like this with a tuple instead of a string for the key:

{('This is one', '001'): '01'}

It looks like extracting key[1] from each key of the second dictionary should yield the keys of the first dictionary. If that is the case, then the following should do it:

d1 = {'001':'01', '002':'02'}
d2 = {('This is one', '001'): '01', ('This is two', '002'): '02'}

if d1 == dict( zip( (k[1] for k in d2.keys()), d2.values() ) ):
    print "They're 'equal'."

HTH,

--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to