S
Sam Loxton
Hi,
I am fairly new to the python language and am trying to sort a nested
Dictionary of a Dictionary which I wish to sort by value. The dictionary
does not have to be restructured as I only need it sorted in this way
for printing purposes.
The following is an example of my Dictionary printed with 'print
dictionary.items()', where '2329513' is the key of the first hash, 'ops'
is the key of the second hash and '50.0' is the value of the second hash
which I would like to sort by:
[('2329513', {'ops': 20.0}), ('2329492', {'ops': '80'}), ('2329490',
{'ops': '50'})]
I hope to sort these first keys by the value of the 'ops' key from
highest to lowest value to give the following result:
[('2329492', {'ops': '80'}), ('2329490', {'ops': '50'}), ('2329513',
{'ops': 20.0})]
Thanks in advance for any help,
Sam.
I am fairly new to the python language and am trying to sort a nested
Dictionary of a Dictionary which I wish to sort by value. The dictionary
does not have to be restructured as I only need it sorted in this way
for printing purposes.
The following is an example of my Dictionary printed with 'print
dictionary.items()', where '2329513' is the key of the first hash, 'ops'
is the key of the second hash and '50.0' is the value of the second hash
which I would like to sort by:
[('2329513', {'ops': 20.0}), ('2329492', {'ops': '80'}), ('2329490',
{'ops': '50'})]
I hope to sort these first keys by the value of the 'ops' key from
highest to lowest value to give the following result:
[('2329492', {'ops': '80'}), ('2329490', {'ops': '50'}), ('2329513',
{'ops': 20.0})]
Thanks in advance for any help,
Sam.