Neal Becker <ndbeck...@gmail.com> writes: > I have a list of dictionaries. They all have the same keys. I want to find > the > set of keys where all the dictionaries have the same values. Suggestions?
Untested, and uses a few more comparisons than necessary: # ds = [dict1, dict2 ... ] d0 = ds[0] ks = set(k for k in d0 if all(d[k]==d0[k] for d in ds)) -- http://mail.python.org/mailman/listinfo/python-list