need dict to maintain order

Erno Kuusela erno-news at erno.iki.fi
Fri Jan 18 11:56:54 EST 2002


In article <mvig4ugd3ts8lpcq8kv9fk89m952hjd9n4 at 4ax.com>, rihad
<rihad at mail.ru> writes:

| Hi there, I'm trying to automate the process of creating so called
| `webpage navbars' by writing an offline python script, but dict
| doesn't seem to give its items in defined order:
[...]

| Which other type would you recommend?

there is no ordered mapping in the standard library. if you want
to use the mapping interface, you can get OrderedDict or
write your own mapping.

or, you can use for example a list of 2-tuples, if it suits your
purpouses.

  -- erno



More information about the Python-list mailing list