I have a list of Dictionaries. Say
[{'name':'Homer', 'age':39, 'desg':'A'}, {'name':'Bart', 'age':10, 'desg':'A'},
{'name':'Lucy', 'age':27, 'desg':'C'}, {'name':'John', 'age':18, 'desg':'B'},
{'name':'Aryan', 'age':20, 'desg':'C'}]
I want to sort this list with desg in order of A,C,B
.
I can sort it in A,B,C
by sorted(list, lambda x: x['desg'])
and reverse by using reverse=True
flag, but unable to sort it in the above mentioned pattern.