azrael a écrit :
> I 'm currenty working on a project for which it would be great to use
> a dictionary. At the begining I have a list of strings that should
> represent the keys in the dictionary. When I try to create a
> dictionary it rearanges the keys. For this dictionary it is realy
> importan
thanks, the links where successfull
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 4, 7:19 am, azrael <[EMAIL PROTECTED]> wrote:
> For this dictionary it is realy
> important to keep the right order. Is it possible to arange them in a
> specific order?
Not sure what order you want, but how about sorting the keys?
def printdict(dict):
"""print sorted key:value pairs"""
See http://www.python.org/doc/faq/general/#how-are-dictionaries-implemented
. In short, keys() and items() return an arbitrary ordering. I think
that http://pypi.python.org/pypi/Ordered%20Dictionary/ will do what
you want if key ordering is a necessity.
Jeff
On Nov 4, 2007, at 8:19 AM, azra
I 'm currenty working on a project for which it would be great to use
a dictionary. At the begining I have a list of strings that should
represent the keys in the dictionary. When I try to create a
dictionary it rearanges the keys. For this dictionary it is realy
important to keep the right order.