[Tutor] Read dictionary data in a specific order...

Alan Gauld alan.gauld at btinternet.com
Sat Aug 25 10:30:10 CEST 2007

"Trey Keown" <trey at opmstech.org> wrote

I just spotted something.

> for (tag,val) in attrs.iteritems():
>    for tag in window_attrs_key_order:
>      print "%s%s = Tk()" %(whitespace, val)


You set tag and val in the outer loop, then you change 
tag in the innrter loop but you never change val.
Thus for each tag in your list you print the same val.

Then you gpo bavk to the outer loop and do the same 
for the next val. You need to rething your variable 
naming and how you access the val.

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list