【发布时间】:2014-01-03 16:18:23
【问题描述】:
我正在尝试弄清楚如何在元组列表中使用 bisect 例如
[(3, 1), (2, 2), (5, 6)]
如何根据每个元组中的 [1] 平分这个列表?
list_dict [(69, 8), (70, 8), ((65, 67), 6)]
tup1,tup2 (69, 8) (70, 8)
list_dict [((65, 67), 6)]
fst, snd ((65, 67),) (6,)
我正在插入平分
idx = bisect.bisect(fst, tup1[1]+tup2[1])
这给了我unorderable types: int() < tuple()
【问题讨论】:
标签: python python-3.3