If you have a very big list, the solutions using .index
will not be very efficient as the first list will be index
'd for each entry in the second list. This will take O(n^2) time.
Instead, you can construct a sort mapping:
order = {v:i for i,v in enumerate(a)}
c = sorted(b, key=lambda x: order[x[0]])