小编Vir*_*ade的帖子

Python列表操作错误:不可用类型'列表'

我有以下列表.

A = [['a', 10], ['b', 50], ['d', 20],['b', 50]]
Run Code Online (Sandbox Code Playgroud)

为什么我不能这样做:

B = set(A)
Run Code Online (Sandbox Code Playgroud)

我收到这个错误:

TypeError: unhashable type: 'list'
Run Code Online (Sandbox Code Playgroud)

你可以看到我没有使用字典.A是列表清单.

>>>type(A) 
<type 'list'>
Run Code Online (Sandbox Code Playgroud)

python dictionary runtime-error list set

0
推荐指数
1
解决办法
3950
查看次数

标签 统计

dictionary ×1

list ×1

python ×1

runtime-error ×1

set ×1