How To Sort List Of Dict
I am trying to sort a list of Dict on the basis of updatedAt values i have tried the following: from pprint import pprint abc = [{'couponVote': 100, u'couponTitle': u'15% off on
Solution 1:
You reverse the sort:
newlist = sorted(abc, key=lambda k: k['updatedAt'], reverse=True)
Now the most recent date is sorted first instead of last.
Post a Comment for "How To Sort List Of Dict"