I want to sort a list of dictionaries using the inbuilt sort() function for lists. The problem is I am not able to understand, how to give the function a key..
Example:
a={'name':1,'data':200}
b={'name':2,'data':400}
c=[a,b]
Now, I want to sort the list c with the key being a. If i use c.sort(), it gives me an error as dictionaries can not be compared. Either I can use a sorting algorithm but that would make my program too complex.
So, can anyone suggest me a beeter approach.