Q:

Python sort list by another list, but the sorting one is a date type

I am trying to sort a list by another one but the sorting one is in date format: %H:%M:%S.
The goal is to create a matplotlib bar graph (no problem on that part).
I know that I can sort the date type one by using:
from datetime import datetime
a = ['0:11:40', '0:10:20', '1:11:10']
a.sort(key=lambda date: datetime.strptime(date, "%H:%M:%S"))

And I also know that I can sort a list by another one by using the zip function.
But I need to accomplish both of them:

listA: type %H:%M:%S
listB: string
listC: string

Example:
listA = ['0:11:40', '0:10:20', '1:11:10']
listB = ['team B', 'team A', 'team C']
listC = ['rgb(255,100,100)','rgb(100,125,125)', 'rgb(125,255,255)']

My idea would be:
%H:%M:%S format → int (seconds)
So I could sort the list as an list of integer (zip with listB and listC), and then go back to %H:%M:%S format to show on top of the bar (plt.text: no issue on that part).
But is there any other "cleaner" method to do so?

A:

You can use simple one-liner:
listA, listB, listC = zip(*sorted(zip(listA, listB, listC), key=lambda o: datetime.strptime(o[0], "%H:%M:%S")))

