I have a list of dictionaries like this but with many more dictionaries:
x = [{"duration":datetime.time(5,30),"date":datetime.date(2016,02,13)},{"duration":datetime.time(3,30),"date":datetime.date(2016,02,11)},{"duration":datetime.time(2,0),"date":datetime.date(2016,02,16)}]
Is there a way to sort this list in ascending order of date
using Python keywords such as sorted
and lambda
without making a custom sorting function? I have been looking at the sorted
docs and the use of lambda
in the optional key
argument.