Python Sort Class dengan atribut

import operator
sorted_x = sorted(x, key=operator.attrgetter('score'))

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