B
Blair Hall
I would like to determine whether two dictionaries have the
same set of keys. Can anyone tell me if I HAVE to sort
the key sequences as in this code snippet:
# d1, d2 already created
k1 = d1.keys()
k1.sort()
k2 = d2.keys()
k2.sort()
# are the keys the same?
same = (k1 == k2)
I am guessing that two dictionaries with the same keys
will sort them in the same order but is this true?
same set of keys. Can anyone tell me if I HAVE to sort
the key sequences as in this code snippet:
# d1, d2 already created
k1 = d1.keys()
k1.sort()
k2 = d2.keys()
k2.sort()
# are the keys the same?
same = (k1 == k2)
I am guessing that two dictionaries with the same keys
will sort them in the same order but is this true?