1. set / dict 使用 hash 值进行索引,其要求欲存储的元素有可哈希的要求。list和dict类型是unhashable(不可哈希)的,所以set的元素不能是list或dict类型,dict的key值也不能是list或dict类型
  2. 集合中的元素是无序的
  3. 可变集合f_set = set([1,5,45,45,54]),不可变集合f_set = frozenset(‘qiwsir’)
  4. python中set()下remove和discard的区别

Python 6种内置类型之集合(set)

相关文章:

  • 2022-12-23
  • 2021-08-10
  • 2021-10-25
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-02
  • 2021-11-02
  • 2022-02-26
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
相关资源
相似解决方案