python基础中遇到的问题(TypeError: unhashable type: 'list')


day20200616

不能向集合中添加列表,字典,集合,会报(TypeError: unhashable type: 'list')错误。

可以添加元组。

s01 = set()
s01.add([1,2,3])
print(s01)

TypeError: unhashable type: 'list'


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM