Python Sorting date
One of the best ways to sort a group of dates is to store them into a list and then apply list's sort() method .This will sort all the dates which are available in the list.
We can store the date class objects into the list using append() method as:
Here, 'd' represents the date class object that is being appended to the list 'list'.
Sorting date example
from datetime import * group =  group.append(date.today()) d = date(2015, 6, 29) group.append(d) d = date(2014, 6, 30) group.append(d) group.append(d+timedelta(days=25)) group.sort() for d in group: print(d)