What's the neatest way of getting dictionary entries in a specified order?

Chris Green cl at isbd.net
Sat Mar 11 05:07:32 EST 2017


Steve D'Aprano <steve+python at pearwood.info> wrote:
> > I want the order to be the same as the order I enter them in.  ;)
> 
> 
> That's not the same thing at all.
> 
> I added Fred to the address book in January. I added Sue to the address book
> in February. I added George to the address book in March. But I want them
> to show up in the order Sue, George, Fred.
> 
The order I was asking about was the order of the *fields* of the
heading (i.e. the column names) *not* the data.  It won't get updated
when new data is added.  What I was after (and got) was a way that
would allow me to extract the data for one entry in my address book in
a particular order.

-- 
Chris Green
·



More information about the Python-list mailing list