nested dictionary get keys sorted by values <p>I'm using a dictionary that has nested dictionaries:</p> <pre><code>dicc={ 'a': {'a1': 1 }, 'b':{'b1':2 }, 'c':{'c1':3 } } # This is an example. I have lots of other keys and values. </code></pre> <p>I need to get the keys ordered by the values. For example, getting <code>c,b,a</code> values: I will work on them in this order; first I need to use <code>c</code> to do other operations then <code>b</code> then <code>a</code>.</p> <p>I used this to get the max value but I need all the values and use them in order mayor to minor:</p> <pre><code>valores=list(diccionario.values()) claves= list(diccionario.keys()) value_= claves[valores.index(max(valores))] </code></pre> <p>edit: i need to get c,b,a sorted on this order and without using a b c , because c has the highest c1 value etc.. ok that works to sort a dict in reverse way but lets say i have this data:</p> <p>1000 10 20 7 2 0</p> <p>1001 3 30 3 5 0</p> <p>1002 3 10 5 3 0</p> <p>1003 7 22 3 1 0</p> <p>second column is a prior, all this is stored into a dictionary the main keys are 1000,1001,1002,1003, the rest are values, i want to get 1000,1003,1002,1001 (this last have same prior) on this order, </p>