[Tutor] Sorting Dictionary of Dictionary by certain Value
Hansen, Mike
Mike.Hansen at atmel.com
Wed Sep 24 16:34:28 CEST 2008
> -----Original Message-----
> Hi Pythonistas,
>
> I have a large dictionary of dictionary (50,000+ keys) which
> has a structure as follows:
> DoD = {
> 'flintstones' : {
> 'husband' : "fred",
> 'pal' : "barney",
> 'income' : 500,
> },
> 'jetsons' : {
> 'husband' : "george",
> 'wife' : "jane",
> 'his boy' : "elroy",
> 'income' : 700,
> },
> 'simpsons' : {
> 'husband' : "homer",
> 'wife' : "marge",
> 'kid' : "bart",
> 'income' : 600,
> },
> };
>
> I want to sort the dictionary by 'income'
> Is there an efficient way to do the same.
> Thanks in advance.
>
> - Jo
>
This sounds like it'd be a good job for a database...perhaps SQLite?
Mike
More information about the Tutor
mailing list