I've got a list of Python objects that I'd like to sort by an attribute of the objects themselves. 我有一個Python對象列表,我想按對象自己的屬性對其進行排序。 The list looks like: 該列表以下所示: ajax
>>> ut [<Tag: 128>, <Tag: 2008>, <Tag: <>, <Tag: actionscript>, <Tag: addresses>, <Tag: aes>, <Tag: ajax> ...]
Each object has a count: 每一個對象都有一個計數: this
>>> ut[1].count 1L
I need to sort the list by number of counts descending. 我須要按遞減計數對列表進行排序。 spa
I've seen several methods for this, but I'm looking for best practice in Python. 我已經看到了幾種方法,可是我正在尋找Python的最佳實踐。 .net