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


Groups > comp.lang.python > #72001

Loop thru the dictionary with tuples

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ikorot01@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.154
X-Spam-Level *
X-Spam-Evidence '*H*': 0.69; '*S*': 0.00; 'all,': 0.19; 'trying': 0.19; 'error': 0.23; 'this:': 0.26; 'values': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'getting': 0.31; 'stuff': 0.32; 'subject:the': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'hi,': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'you.': 0.62; '"too': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=XYhasPGXvETiP3RrEWXpfBy9VkekRpmoRd9hFC9qDas=; b=uo1tgpfQVhG/dOUvPqPuh73dgbDhZYaPLY0wwhaQlPrTitGNLrxyMyuxpfNPbY6AIl P2UChajY0Oquj1QXdDXy0AfahnuZ10f+IfqFOnhCS0w3zsY9xSLkDViNmtOamc7zLKxV QUT3vtZds3kmDXNNUXzmswHbPvMXgITkz7eiP2KsujsdBcift0aLfvTFNsEiBRHchb9E OlUB0JKEknerhUISZwGPbzpgw2AN3il99ORC0KuTS9osCdcbgzwaW+mqWAOc2L1bs0f+ LlRANteoAqw4zP8KyLZ4BovfqQV40I18yBapaa04Tc4j36Yv30tI05KVGtNNv6nMsAB+ M8nA==
MIME-Version 1.0
X-Received by 10.221.44.73 with SMTP id uf9mr15282057vcb.9.1401022500850; Sun, 25 May 2014 05:55:00 -0700 (PDT)
Date Sun, 25 May 2014 05:55:00 -0700
Subject Loop thru the dictionary with tuples
From Igor Korot <ikorot01@gmail.com>
To 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.10291.1401022510.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401022510 news.xs4all.nl 2836 [2001:888:2000:d::a6]:39176
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72001

Show key headers only | View raw


Hi, ALL,
I have a following data structure:

my_dict[(var1,var2,var3)] = None
my_dict[(var4,var5,var6)] = 'abc'

What I'm trying to do is this:

for (key,value) in my_dict:
    #Do some stuff

but I'm getting an error "Too many values to unpack".

What am I doing wrong?

Thank you.

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


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