I have some Entrys in a python list.Each Entry has a creation date and creation time.The values are stored as python datetime.date and datetime.time (as two separate fields).I need to get the list of Entrys sorted sothat previously created Entry comes before the others.
I know there is a list.sort() function that accepts a key function.In this case ,do I have to use the date and time to create a datetime and use that as key to sort()? There is a datetime.datetime.combine(date,time) for this. But how do I specify this inside the sort function?
I tried key = datetime.datetim.combine(created_date,created_time)
but the interpreter complains that the name created_date is not defined
class Entry:
created_date = #datetime.date
created_time = #datetime.time
...
my_entries_list=[Entry1,Entry2...Entry10]
my_entries_list.sort(key = datetime.datetim.combine(created_date,created_time))