作业帮 > 英语 > 作业

该怎么处理

来源:学生作业帮 编辑:拍题作业网作业帮 分类:英语作业 时间:2024/05/29 15:40:35
该怎么处理
在Python中list的内容是可变的,不可hash,因此不能作为dict的keys.
所以会出现这种提示:
unhashable type:'list'
Lists cannot be dictionary keys – more on this later:
>>> mydict = {[1,2] :"wont_work"}
Traceback (most recent call last):
File "",line 1,in
TypeError:unhashable type:'list