【发布时间】:2014-08-27 06:11:50
【问题描述】:
我有一个类,它包含两个列表,一个 int 和一个字符串。看起来像这样
class Something:
num = 0
def __init__(self, clu, pro)
self.clu = clu
self.rep = []
self.rep_dis = []
self.pro = ""
现在我主要保留Something 对象的列表。
something_list = []
tmp_something = Something("this", "that")
tmp_something.rep.append("some")
tmp_something.rep_dis.append("thing")
something_list.append(tmp_something)
如何按对象列表rep 的长度对该列表进行排序?
编辑:代码段格式
【问题讨论】:
标签: python list sorting object