totalCost = problem.getCostOfActions(self.actions)
Run Code Online (Sandbox Code Playgroud)
Bjö*_*lex 15
看起来你正在尝试使用列表作为字典中的键或类似的东西.列表不可清除,因此它们不能用作字典键或集合.
另一方面,python在发生此类错误时为您提供堆栈跟踪,其中包括文件名和行号.您应该能够使用该跟踪来查找有问题的代码.
编辑关于stacktraces:
cat > script.py
foo = [1,2,3]
bar = {}
bar[foo] = "Boom"
print "Never happens"
python script.py
Traceback (most recent call last):
File "script.py", line 3, in <module> // this is the file and the line-number
bar[foo] = "Boom"
TypeError: unhashable type: 'list'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8931 次 |
| 最近记录: |