import time
timestamp = [
"2020-06-10 17:05:30",
"2020-06-10 17:05:29",
"2020-06-10 17:04:21",
"2020-06-10 17:04:22",
"2020-05-10 17:08:19",
"2020-05-10 17:08:21",
"2020-05-10 17:08:18",
"2020-05-10 17:09:00",
"2020-04-10 17:11:02",
"2020-04-10 17:11:01"
]
timestamp.sort(key=lambda x: time.strptime(x, '%Y-%m-%d %H:%M:%S')[0:6], reverse=True)
for dt in timestamp:
print(dt)
'''
run:
2020-06-10 17:05:30
2020-06-10 17:05:29
2020-06-10 17:04:22
2020-06-10 17:04:21
2020-05-10 17:09:00
2020-05-10 17:08:21
2020-05-10 17:08:19
2020-05-10 17:08:18
2020-04-10 17:11:02
2020-04-10 17:11:01
'''