1
두 개의 목록을 에 따라 a
에 따라 정렬하고 두 개의 정렬 된 목록을 아래에서 정확하게 수행 한대로 다시 반환하는 것이 정확합니다.목록 정렬 - pythonic 방법
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 이것은 파이썬 2.7