First of all, the structure you want as output is not a python list
format.
Actually, it is not also a dictionary format either.
From your question, I've learned that you want to make a list of dictionaries.
First, make a dictionary element:
0: {'First': 'Art (40.0%)'}
to
{0: {'First': 'Art (40.0%)'}}
Then, you will be ready to make a list of a dictionary and your data structure will look like:
[ {0: {'First': 'Art (40.0%)'}},
{1: {'Second': 'Nat (21.33%)'}},
{2: {'Third': 'per (20.67%)'}},
{3: {'Fourth': 'Ser (20.0%)'}},
{4: {'Fifth': 'blind (19.33%)'}}
]
you can check the structure:
list = [ {0: {'First': 'Art (40.0%)'}},
{1: {'Second': 'Nat (21.33%)'}},
{2: {'Third': 'per (20.67%)'}},
{3: {'Fourth': 'Ser (20.0%)'}},
{4: {'Fifth': 'blind (19.33%)'}}
]
print(type(a))
print(type(list[0]))
Output:
<class 'list'>
<class 'dict'>
And the code
dict_value = {'Attributes': {'Fifth': 'blind (19.33%)',
'First': 'Art (40.0%)',
'Fourth': 'Ser (20.0%)',
'Second': 'Nat (21.33%)',
'Third': 'per (20.67%)'}}
order = {value: key for key, value in enumerate(('First', 'Second', 'Third', 'Fourth', 'Fifth'))}
sorted_form = sorted(dict_value['Attributes'].items(), key=lambda d: order[d[0]])
final_list = [dict(enumerate({key: value} for key, value in sorted_form))]
print(final_list)
produces
[{0: {'First': 'Art (40.0%)'}, 1: {'Second': 'Nat (21.33%)'}, 2: {'Third': 'per (20.67%)'}, 3: {'Fourth': 'Ser (20.0%)'}, 4: {'Fifth': 'blind (19.33%)'}}]