Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72009
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.046 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; 'assignment': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; '(key,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hint:': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'print': 0.22; 'either.': 0.24; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; 'subject:the': 0.34; "i'd": 0.34; 'could': 0.34; 'subject:with': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'so,': 0.37; 'step': 0.37; 'pm,': 0.38; 'either': 0.39; 'matter': 0.61; 'happen': 0.63; 'line,': 0.68; 'smith': 0.68; 'safety,': 0.91; 'to:none': 0.92 |
| 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:cc :content-type; bh=ZelIWUv6M18LKJ40cMABSnGMrO8/MM5Q53avamJ+y7g=; b=l4ciBXGfWXgskQx6ypTG7IxyoFdMW0RuLtTzSWrDFzTSKUo0KqsmnaWp6rzQ2pIcbv 8FKLnc/8GNrS+f8oVqYyhPQJ9bHiPpnDkTFCRglr3XhMgnePkdL3a4Yzak21u2oYGE2B 5+RRfk8NxTUO//8suCbPooRhLzKyQtZ5r338+ZIDNj+/Y4NDZiSUZn6wR0ZPaCOY4dB9 NzhuGWAlLNytm9ELY817bVPetZq31GFwXoPuLSGCUgpSUUfgg4xbCTV7btgAEGX9QhhM RgOAQ/1vi2y784sJ2SBZhliWwegoHwUATQ2Gcax2D1dtlX5Ml8Eara7vRoajFouqka33 PabA== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.95.2 with SMTP id b2mr279536vcn.61.1401026335120; Sun, 25 May 2014 06:58:55 -0700 (PDT) |
| In-Reply-To | <roy-F52825.09220325052014@news.panix.com> |
| References | <mailman.10291.1401022510.18130.python-list@python.org> <roy-F52825.09220325052014@news.panix.com> |
| Date | Sun, 25 May 2014 23:58:55 +1000 |
| Subject | Re: Loop thru the dictionary with tuples |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10297.1401026343.18130.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1401026343 news.xs4all.nl 2879 [2001:888:2000:d::a6]:33269 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:72009 |
Show key headers only | View raw
On Sun, May 25, 2014 at 11:22 PM, Roy Smith <roy@panix.com> wrote:
> Hint: in this case,
> it will happen on the assignment line, so, your next step is to print
> everything out and see what's going on:
>
> for thing in my_dict:
> print thing
> (key, value) = thing
Aside: I know that you (Roy) are still using Python 2, but the OP
could be on either branch. As a matter of safety, I'd put parens
around the print:
for thing in my_dict:
print(thing)
(key, value) = thing
That way, it works on either.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Loop thru the dictionary with tuples Igor Korot <ikorot01@gmail.com> - 2014-05-25 05:55 -0700
Re: Loop thru the dictionary with tuples Paul Rubin <no.email@nospam.invalid> - 2014-05-25 05:59 -0700
Re: Loop thru the dictionary with tuples Tim Chase <python.list@tim.thechases.com> - 2014-05-25 08:07 -0500
Re: Loop thru the dictionary with tuples Roy Smith <roy@panix.com> - 2014-05-25 09:22 -0400
Re: Loop thru the dictionary with tuples Chris Angelico <rosuav@gmail.com> - 2014-05-25 23:58 +1000
csiph-web