Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How to find the minimum (earliest) date?
There is a list with lists of dates:
[, [[datetime.datetime(2016, 7, 31, 19, 29, 56, 608000), datetime.datetime(2016, 7, 31, 19, 29, 56, 605000)]]]
for date in dates:
check = datetime.timestamp(date)
if check mindate:
mindate = check
dateofstartpay1.append(mindate)
print(dateofstartpay1)
but this is what happened:AttributeError: type object 'datetime.datetime' has no attribute 'timestamp'
. For the life of me, I can’t understand what the problem is and how to redo it so that everything works as it should.
Answer the question
In order to leave comments, you need to log in
>>> import datetime
>>>
>>> lst = [[datetime.datetime(2016, 6, 19, 23, 5, 33, 899000),
... datetime.datetime(2016, 6, 19, 23, 5, 33, 897000)],
... [datetime.datetime(2016, 7, 31, 19, 29, 56, 608000),
... datetime.datetime(2016, 7, 31, 19, 29, 56, 605000)]]
>>>
>>> list(map(min, lst))
[datetime.datetime(2016, 6, 19, 23, 5, 33, 897000), datetime.datetime(2016, 7, 31, 19, 29, 56, 605000)]
>>>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question