Thursday, May 03, 2018

Python Sorting Two Lists Together

I don't get it either, but it works..

https://codereview.stackexchange.com/questions/138702/sorting-two-lists

s = sorted( zip( a, b) )    # a is master, b is slave
a,b = map( list, zip(*s) )
# and that's it! The genius of Guido Van Rossum

No comments: