Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29485
| Date | 2012-09-19 14:13 +0200 |
|---|---|
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
| Subject | Re: A little morning puzzle |
| References | <k3c9jb$2gr$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.912.1348056865.27098.python-list@python.org> (permalink) |
On 19-09-12 13:17, Neal Becker wrote: > 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? common_items = reduce(opereator.__and__, [set(dct.iteritems()) for dct in lst]) common_keys = set([item[0] for item in common_items]) -- Antoon Pardon
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: A little morning puzzle Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2012-09-19 14:13 +0200
csiph-web