Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,961 questions

51,903 answers

573 users

How to descending sort a list of time items in H:M:S format in Python

1 Answer

0 votes
times_list = ['2017-11-05 13:29:21', '2017-11-05 13:29:05', '2017-11-05 16:21:00',
              '2017-11-05 11:40:00', '2017-11-05 14:43:00', '2017-11-05 18:10:00',
              '2017-11-05 15:31:00', '2017-11-05 12:66:00', '2017-11-05 16:15:00']


times_list = sorted(times_list, reverse=True)

print(times_list)


'''
run:

['2017-11-05 18:10:00', '2017-11-05 16:21:00', '2017-11-05 16:15:00', '2017-11-05 15:31:00',
'2017-11-05 14:43:00', '2017-11-05 13:29:21', '2017-11-05 13:29:05', '2017-11-05 12:66:00',
'2017-11-05 11:40:00']

'''

 



answered Nov 5, 2017 by avibootz
...