0

I have a list of dictionary in following format:

data = [{'diff': '2:0', 'running': '-428:0', 'worked_hours': '12:0', 'name': '2015-05-21', 'dh': '10:0'},
{'diff': '-9:49', 'running': '-437:49', 'worked_hours': '0:11', 'name': '2015-05-22', 'dh': '10:0'},
{'diff': '0:0', 'running': '-437:49', 'worked_hours': '0:0', 'name': '2015-05-23', 'dh': '0:0'},
{'diff': '0:0', 'running': '-437:49', 'worked_hours': '0:0', 'name': '2015-05-24', 'dh': '0:0'}]

Now, I want to arrange my dictionary in the following way:

[{'name': '2015-05-21', 'dh': '10:0', 'worked_hours': '12:0', 'diff': '2:0', 'running': '-428:0'}
...]

How can I do this?

Maroun
  • 94,125
  • 30
  • 188
  • 241
ueg
  • 1
  • 4
    Dictionary keys are not ordered. Perhaps you want an [`OrderedDict`](https://docs.python.org/3/library/collections.html#collections.OrderedDict)? – Amber May 27 '15 at 06:21
  • As Amber said, if you are using python 2.7+, take a look at OrderedDict – WKPlus May 27 '15 at 06:29

0 Answers0