📌  相关文章
📜  按另一个python代码示例的值对列表进行排序

📅  最后修改于: 2022-03-11 14:46:51.125000             🧑  作者: Mango

代码示例1
numbers = [1, 2, 3]
letters = ['c', 'a', 'b']

#The numbers array sorted by the letters order
sorted_list = [number for letter, number in sorted(zip(letters, numbers))]

print(sorted_list)
#prints: [2, 3, 1]