1
をa
に従って2つのリストにソートし、2つのソートされたリストを別々に戻します。リストを並べ替える - ピジョンソニック
a = ['apple','carrot','banana']
b = [5,10,15]
s = sorted(zip(a,b))
a,b = map(list, zip(*s))
print a
print b
['apple', 'banana', 'carrot']
[5, 15, 10]
ただし、これを行うにはどんな良い方法がありますか? Given condition: Two lists, a and b.
Result: As printed above
PSは、これは、Python 2.7