sort a dictionary by keys in specific order
Wolfgang Grafen
wolfgang.grafen at marconi.com
Mon May 29 05:49:28 EDT 2006
spohle wrote:
> hi i have a normal dictionary with key and value pairs. now i wanna
> sort by the keys BUT in a specific order i determine in a list !? any
> ideas
>
> dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'}
>
> list = [key2, key3, key1]
>
You could use the seqdict package at
http://home.arcor.de/wolfgang.grafen/Python/Modules/Modules.html
Regards
Wolfgang
More information about the Python-list
mailing list