fork(1) download
  1. import locale
  2.  
  3. from datetime import datetime
  4.  
  5. s = """
  6. 6 Jan @ 4:03pm
  7. 8 Jan @ 2:17pm
  8. 9 Dec @ 4:00am
  9. 9 Dec @ 5:14pm
  10. 9 Dec @ 5:28am
  11. 10 Jan @ 2:55pm
  12. 10 Jan @ 4:21am
  13. 10 Jan @ 7:14pm
  14. 12 Dec @ 7:48pm
  15. 12 Dec @ 7:50pm
  16. 12 Jan @ 3:32pm
  17. 13 Dec @ 3:43pm
  18. 13 Dec @ 5:02am
  19. 13 Dec @ 5:24am
  20. 14 Jan @ 5:17pm
  21. 15 Jan @ 5:29am
  22. 21 Dec @ 3:56pm
  23. 21 Dec @ 9:40am
  24. """
  25.  
  26. locale.setlocale(locale.LC_ALL, "en_US.utf8")
  27.  
  28. fmt = "%d %b @ %I:%M%p"
  29. lines = filter(len, str.split(s, "\n"))
  30. for d in sorted(map(lambda line: datetime.strptime(line, fmt), lines)):
  31.  
  32. print(datetime.strftime(d, fmt))
  33.  
Success #stdin #stdout 0.04s 10880KB
stdin
Standard input is empty
stdout
06 Jan @ 04:03PM
08 Jan @ 02:17PM
10 Jan @ 04:21AM
10 Jan @ 02:55PM
10 Jan @ 07:14PM
12 Jan @ 03:32PM
14 Jan @ 05:17PM
15 Jan @ 05:29AM
09 Dec @ 04:00AM
09 Dec @ 05:28AM
09 Dec @ 05:14PM
12 Dec @ 07:48PM
12 Dec @ 07:50PM
13 Dec @ 05:02AM
13 Dec @ 05:24AM
13 Dec @ 03:43PM
21 Dec @ 09:40AM
21 Dec @ 03:56PM