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


Groups > comp.lang.python > #29956

Re: A little morning puzzle

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'keys,': 0.07; 'alter': 0.09; 'received:mail-vc0-f174.google.com': 0.09; 'cc:addr:python- list': 0.10; 'produces': 0.22; 'posted': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'prints': 0.29; 'received:209.85.220.174': 0.29; 'code': 0.31; 'print': 0.32; 'asked': 0.33; 'times.': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'shows': 0.38; 'header:Received:5': 0.40; 'different': 0.63; 'for:': 0.64; 'same,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=z9oLE7Q8u5H/5ZcpVyJXzcFo+HxHDqccSi95LUT8wXU=; b=f/CWyeKVWKvu6iqmv/esKoGV4Raoah2vlb9L8KYlNMElhJplhiVx8952SWGxMhFTGX tkRHkZO5so8XP6XuG17IHK9g8a3adJ50yXwJL6wKZZfb8d9TEa7lZvCZR80mwzGbfZFA faordwbTkb3O01kxc1k8glZvYaGvoP8j/yIjyoBJm/g5wx1s12kINKk/DmjlhNit8zIo Y/6dpBZAk2T4Xjxe19A1cvkeLfmTF6p53XN9YKN1FAH7DkNWIAe9/teV8URmxkEuzmQ6 dgWhWGYQEiYwo/1QYLhcdjSz1Xm3oYhE08OhARHC0Zb6QQnWQGbcqOM7CcZ++cF7ao// ExtA==
MIME-Version 1.0
In-Reply-To <CALwzid=QxjfVtL7M8mWRg_k9qiNs+5-wP7d7B8vHss3qyGeiPw@mail.gmail.com>
References <k3c9jb$2gr$1@ger.gmane.org> <CA+vVgJXh2PyeAT5LdWD6twijHPhmAoL9UPJxj+QJXvmey-WAgQ@mail.gmail.com> <mailman.911.1348056502.27098.python-list@python.org> <evH6s.1159$U54.270@newsfe01.iad> <CA+vVgJVbkYc=O_fhkSNGPKwF80Jg6X7LTOvdQAJ_agoOQbLOVg@mail.gmail.com> <CALwzidn7ztCJup+kPTVwLFFJj-Hxg5EM0PFsryHzca1T9DA9Aw@mail.gmail.com> <5060CE37.8080409@stoneleaf.us> <CA+vVgJXsGE_yLkmNFVNBKZGdZK7cB5FD+j0u6skhxt4UZrJN3A@mail.gmail.com> <CALwzid=QxjfVtL7M8mWRg_k9qiNs+5-wP7d7B8vHss3qyGeiPw@mail.gmail.com>
Date Mon, 24 Sep 2012 19:13:39 -0400
Subject Re: A little morning puzzle
From Dwight Hutto <dwightdhutto@gmail.com>
To Ian Kelly <ian.g.kelly@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1239.1348528422.27098.python-list@python.org> (permalink)
Lines 45
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348528423 news.xs4all.nl 6958 [2001:888:2000:d::a6]:43632
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29956

Show key headers only | View raw


The posted code produces neither a set nor any keys;
> it prints out the same predetermined non-key value multiple times.

This shows multiple dicts, with the same keys, and shows different
values, and some with the same, and that is, in my opinion what the OP
asked for:

a = {}
a['dict'] = 1

b = {}
b['dict'] = 2

c = {}
c['dict'] = 1

d = {}
d['dict'] = 3

e = {}
e['dict'] = 1


x = [a,b,c,d,e]
count = 0
collection_count = 0
search_variable = 1
for dict_key_search in x:
        if dict_key_search['dict'] == search_variable:
                print "Match count found: #%i = %i" % (count,search_variable)
                collection_count += 1
        count += 1
print collection_count



The OP can jump in and tell me to alter the example, if they want to.




-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: A little morning puzzle Peter Otten <__peter__@web.de> - 2012-09-19 14:09 +0200
  Re: A little morning puzzle Tobiah <toby@tobiah.org> - 2012-09-20 09:28 -0700
    Re: A little morning puzzle Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-22 23:44 -0400
      Re: A little morning puzzle alex23 <wuwei23@gmail.com> - 2012-09-23 20:46 -0700
        Re: A little morning puzzle Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 17:22 -0400
        RE: A little morning puzzle "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-09-27 17:58 +0000
    Re: A little morning puzzle Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-23 22:51 -0600
    Re: A little morning puzzle Ethan Furman <ethan@stoneleaf.us> - 2012-09-24 14:18 -0700
    Re: A little morning puzzle Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 18:07 -0400
    Re: A little morning puzzle Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-24 17:01 -0600
    Re: A little morning puzzle Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 19:13 -0400

csiph-web