📜  python 按属性排序类 - Python 代码示例

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

代码示例1
import operator
sorted_x = sorted(x, key=operator.attrgetter('score'))

# In Place:
x.sort(key=operator.attrgetter('score'))