Contents

本质上的区别

最重要的区别在于是否可变是否有序这两个维度,可以分成4个象限,如下图

Python的四种常见数据结构比较
比较

语法上的比较

list tuple dict set
创建 a=[element1,element2,...] a=(element1,element2,...) a={key1(不可变):value1,...} a={[list]};a={element1,...}
操作 in;append();len();insert();pop();a[-1] in in;dict[index];dict[newkey:value] add();remove()

相关文章:

  • 2021-12-20
  • 2021-06-09
  • 2022-02-03
  • 2022-01-07
  • 2021-12-12
  • 2021-10-29
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2021-05-13
  • 2021-06-12
  • 2022-01-29
  • 2021-11-14
  • 2021-11-23
相关资源
相似解决方案