I'm trying to change the order of 'keys' in a dictionary, with no success. This is my initial dictionary:
Not_Ordered={
'item':'book',
'pages':200,
'weight':1.0,
'price':25,
'city':'London'
}
Is there a chance for me to change the order according to a key-order list, like this:
key_order=['city', 'pages', 'item', 'weight', 'price']
note:
- I'm using Python 3.5.2.
- I'm not looking for sorting the keys.
- I'm aware that Python 3.6 follows the insertion.
- Also, I'm aware of OrderedDict, but it gives me a list, but I'm looking for a dictionary as final result.