I have two list x and y. The former is always longer than or equal to the latter.
x = ["foo","bar","qux","zox"]
y1 = ["zox", "qux","foo"]
What I want to do is to sort y1 based on the order of x.
Yielding
["foo","qux","zox"]
I tried this, but doesn't work:
In [10]: [x[1] for x in sorted(zip(x,y))]
Out[10]: ['zox', 'qux']
What's the right way to do it?