RE: quick python question

  • From: "Homme, James" <james.homme@xxxxxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 3 Apr 2009 10:29:35 -0400

Hi Jim,
What's the difference between the two syntaxes in the way Python handles this? 
Is it 3.0 as opposed to older Python?

Thanks.

Jim

----------
Jim Homme, Usability Engineering.
412-544-1810.
Catch the gratitude attitude.

From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Dunleavy
Sent: Friday, April 03, 2009 9:28 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: quick python question

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<mailto:tyler@xxxxxxxxxxxxx>
To: programmingblind@xxxxxxxxxxxxx<mailto: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<mailto:tyler@xxxxxxxxxxxxx>
My programs don't have bugs, they're called randomly added features.

________________________________
This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed. If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it. If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.

Other related posts: