类型错误,list是不可哈希的
例1:向set()中添加list,需要转为tuple才能加进去
res = set()
tmp = [-1, -1, 2]
res.add(tuple(tmp))
print(res) # {(-1, -1, 2)}
例2:利用set() 去重
res = [[-1, -1, 2], [-1, 0, 1], [-1, 0, 1]]
set_res = set(tuple(item) for item in res)
print(set_res) # {(-1, 0, 1), (-1, -1, 2)}
res = [list(item) for item in set_res]
print(res) # [[-1, 0, 1], [-1, -1, 2]]