python中无法被转化为set的list[list组成的list]

Posted 夜歌乘年少

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python中无法被转化为set的list[list组成的list]相关的知识,希望对你有一定的参考价值。

arr = [[a],[b]]

set(arr)

output:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: ‘list‘

 

arr =[1,2]

set(arr)

output:

set([1,2])



以上是关于python中无法被转化为set的list[list组成的list]的主要内容,如果未能解决你的问题,请参考以下文章