Re: quick python question

  • From: Jim Dunleavy <jim.dunleavy@xxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 03 Apr 2009 14:28:03 +0100

Hi Tyler,

That just iterates on the keys.
You need to do:
for key, val in self.vars.iteritems():
or
for key, val in self.vars.items():

--Jim


----- Original Message ----- 
From: Tyler Littlefield 
To: programmingblind@xxxxxxxxxxxxx 
Sent: Friday, April 03, 2009 12:02 PM
Subject: quick python question


Hello list,
I've got a question; I'm trying to itterate through a dictionary like:
for key,val in self.vars:
  print key
print val
 
when I do it, it says "to many values to unpack."
What's that supposed to mean? Is there a way of debugging the code so I can 
make sure this is really a dictionary?


Thanks,
Tyler Littlefield
Web: tysdomain.com
email: tyler@xxxxxxxxxxxxx
My programs don't have bugs, they're called randomly added features.

----------------------------------------------------------------------------
"Information in this email (including attachments) is confidential.  
It is intended for receipt and consideration only by the intended recipient.
If you are not an addressee or intended recipient, any use, dissemination,
distribution, disclosure, publication or copying of information contained in
this email is strictly prohibited.  Opinions expressed in this email may be
personal to the author and are not necessarily the opinions of the HSE.

If this email has been received by you in error we would be grateful if you 
could immediately notify the ICT Service Desk by telephone at +353 1 6352757 
or by email to service.desk@xxxxxx and thereafter delete this
e-mail from your system"
----------------------------------------------------------------------------

Other related posts: