标签:most last lin error: font stdin print 重复 size
众所周知,list去掉重复元素可将list转为set即可,
but,
>>> test = [1,2,‘a‘,‘a‘] >>> test1= list(set(test)) >>> print(test1) [1, 2, ‘a‘] >>> test.append([‘a‘]) >>> print(test) [1, 2, ‘a‘, ‘a‘, [‘a‘]] >>> test2= list(set(test)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: ‘list‘ >>>
list去重,TypeError: unhashable type: 'list'
标签:most last lin error: font stdin print 重复 size
原文地址:https://www.cnblogs.com/guweixin/p/13269588.html