sort dictionary in python ordered dict code example
Example 1: sort list of dictionaries by key python
newlist = sorted(list_to_be_sorted, key=lambda k: k['name'])
Example 2: python Ordered dict to dict
>>> from collections import OrderedDict
>>> dict(OrderedDict([('method', 'constant'), ('data', '1.225')]))
{'data': '1.225', 'method': 'constant'}