<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#3333ff">
<font size="+1">This might help you.<br>
<br>
<a class="moz-txt-link-freetext" href="http://blog.modp.com/2008/09/sorting-python-dictionary-by-value-take.html">http://blog.modp.com/2008/09/sorting-python-dictionary-by-value-take.html</a><br>
<br>
<br>
Robert<br>
</font><br>
Joe Python wrote:
<blockquote
cite="mid:cdd15f120809231741of284e4fi5b49eb1ca096d015@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Pythonistas,<br>
<br>
I have a large dictionary of dictionary (50,000+ keys) which has a
structure as follows:<br>
DoD = {<br>
'flintstones' : {<br>
'husband' : "fred",<br>
'pal' : "barney",<br>
'income' : 500,<br>
},<br>
'jetsons' : {<br>
'husband' : "george",<br>
'wife' : "jane",<br>
'his boy' : "elroy",<br>
'income' : 700,<br>
},<br>
'simpsons' : {<br>
'husband' : "homer",<br>
'wife' : "marge",<br>
'kid' : "bart",<br>
'income' : 600,<br>
},<br>
};<br>
<br>
I want to sort the dictionary by 'income'<br>
Is there an efficient way to do the same.<br>
Thanks in advance.<br>
<br>
- Jo<br>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Tutor maillist - <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
</pre>
</blockquote>
</body>
</html>