I have list of dictionaries. Now, in every dictionary, i want to add a key value pair(key : 'message1') at the beginning of the dict, but when i add it , its getting added to the end.
Following is my code
data=[{
'message2': 'asd',
'message3': 'fgw',
'message4': 'fgeq',
'message5': 'gqe',
'message6': 'afgq',
'message7': 'major',
'message8': 'color-regular'
}]
for i in data:
i['message1'] = '111'
Following is the output i am getting where message1 is appended in the end
[{'message2': 'asd',
'message3': 'fgw',
'message4': 'fgeq',
'message5': 'gqe',
'message6': 'afgq',
'message7': 'major',
'message8': 'color-regular',
'message1': '111'# i want this in the beginning}]
Please suggest a workaround