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


Groups > comp.lang.python > #72001

Loop thru the dictionary with tuples

Date 2014-05-25 05:55 -0700
Subject Loop thru the dictionary with tuples
From Igor Korot <ikorot01@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.10291.1401022510.18130.python-list@python.org> (permalink)

Show all headers | 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