temp = [{'name':'abcd3', "id":3},
{'name':'abcd', "id":1},
{'name':'abcd4', "id":4},
{'name':'abcd2', "id":2},]
How to sort temp using id.
temp = [{'name':'abcd3', "id":3},
{'name':'abcd', "id":1},
{'name':'abcd4', "id":4},
{'name':'abcd2', "id":2},]
How to sort temp using id.
You sort by using the sort method on the object. ie
temp.sort()
Solution which is none destructive or does not mutate object use
sorted(temp,key=lambda x:x['id'])