Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29481
| Path | csiph.com!usenet.pasdenom.info!goblin3!goblin.stu.neva.ru!newsfeed3.funet.fi!newsfeeds.funet.fi!news.helsinki.fi!.POSTED!not-for-mail |
|---|---|
| From | Jussi Piitulainen <jpiitula@ling.helsinki.fi> |
| Newsgroups | comp.lang.python |
| Subject | Re: A little morning puzzle |
| Date | 19 Sep 2012 14:34:41 +0300 |
| Organization | University of Helsinki |
| Lines | 8 |
| Sender | jpiitula@ruuvi.it.helsinki.fi |
| Message-ID | <qotfw6e4566.fsf@ruuvi.it.helsinki.fi> (permalink) |
| References | <mailman.907.1348053436.27098.python-list@python.org> |
| NNTP-Posting-Host | ruuvi.it.helsinki.fi |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | oravannahka.helsinki.fi 1348054481 17150 128.214.205.65 (19 Sep 2012 11:34:41 GMT) |
| X-Complaints-To | usenet@oravannahka.helsinki.fi |
| NNTP-Posting-Date | Wed, 19 Sep 2012 11:34:41 +0000 (UTC) |
| User-Agent | Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
| Xref | csiph.com comp.lang.python:29481 |
Show key headers only | View raw
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