【发布时间】:2020-11-16 09:13:23
【问题描述】:
TypeError Traceback(最近一次调用最后一次) 在
1 slt = SortedList(load = 1000)
2 assert slt._load == 10000
3 assert slt._twice == 20000
4 assert slt._half == 5000
5 slt._check()
TypeError: new() 得到了一个意外的关键字参数 'load'
【问题讨论】:
-
为什么我会出错在这我引用了这个programcreek.com/python/example/90730/…
-
如果我得到了正确的文档SortedList 需要一个可迭代和可选的键,而不是“加载”。
-
哦等等,在这个例子中,它的
SortedListWithKey有“load”参数。 -
还是不行
-
22 votes = {} 23 for _,v in sl: ---> 24 votes[v] = votes.get(v, 0) + 1 25 max_votes = 0 26 max_votes_class= -1 TypeError: unhashable type: 'matrix'