print('PNlist:',set(PNlist)) TypeError: unhashable type: 'dict'
时间: 2023-12-07 07:36:22 浏览: 34
这段代码中出现了一个类型错误,即“TypeError: unhashable type: 'dict'”。这是因为在set()函数中传入了一个字典类型的变量,而字典是不可哈希的(unhashable),因此无法被放入set()中。如果你想要将字典类型的变量去重,可以使用其他方法,例如使用列表推导式或循环遍历去重。具体实现方法可以根据你的需求和数据结构进行选择。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)