Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29485 > unrolled thread

Re: A little morning puzzle

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2012-09-19 14:13 +0200
Last post2012-09-19 14:13 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: A little morning puzzle Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2012-09-19 14:13 +0200

#29485 — Re: A little morning puzzle

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2012-09-19 14:13 +0200
SubjectRe: A little morning puzzle
Message-ID<mailman.912.1348056865.27098.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web