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

2007-08-25 Thread Alan Gauld
"Trey Keown" <[EMAIL PROTECTED]> wrote I just spotted something. > for (tag,val) in attrs.iteritems(): >for tag in window_attrs_key_order: > print "%s%s = Tk()" %(whitespace, val) etc... You set tag and val in the outer loop, then you change tag in the innrter loop but you never chan

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

2007-08-25 Thread Alan Gauld
"Trey Keown" <[EMAIL PROTECTED]> wrote > window_attrs_key_order = ["name", "title", "icon"] > for (tag,val) in attrs.iteritems(): > for (tag,val) in attrs.iteritems(): > if tag in window_attrs_key_order: > for tag in window_attrs_key_order: > if tag == u"name": > print

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

2007-08-24 Thread Trey Keown
> "Trey Keown" <[EMAIL PROTECTED]> wrote > >> I would like to know, how can I read (or sort) a dictionary in a >> certain >> order? > > Dictionaries are by design unsorted and indeed may even change > their order during their lifetime. > >> attrs={u'title': u'example window title', u'name': u'SELF'

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

2007-08-24 Thread Alan Gauld
"Trey Keown" <[EMAIL PROTECTED]> wrote > I would like to know, how can I read (or sort) a dictionary in a > certain > order? Dictionaries are by design unsorted and indeed may even change their order during their lifetime. > attrs={u'title': u'example window title', u'name': u'SELF', u'icon': >

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

2007-08-24 Thread Trey Keown
Hello. I would like to know, how can I read (or sort) a dictionary in a certain order? say this is my dictionary- attrs={u'title': u'example window title', u'name': u'SELF', u'icon': u'e.ico'} how could I get the data so that u'name' is read first, u'title' second, and u'icon' third? thanks so much