Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29481
| From | Jussi Piitulainen <jpiitula@ling.helsinki.fi> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: A little morning puzzle |
| Date | 2012-09-19 14:34 +0300 |
| Organization | University of Helsinki |
| Message-ID | <qotfw6e4566.fsf@ruuvi.it.helsinki.fi> (permalink) |
| References | <mailman.907.1348053436.27098.python-list@python.org> |
Neal Becker 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?
Literally-ish:
{ key for key, val in ds[0].items() if all(val == d[key] for d in ds) }
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A little morning puzzle Neal Becker <ndbecker2@gmail.com> - 2012-09-19 07:17 -0400 Re: A little morning puzzle Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-09-19 14:34 +0300 Re: A little morning puzzle Paul Rubin <no.email@nospam.invalid> - 2012-09-19 10:12 -0700
csiph-web