logo
  • 教程列表
  • SO官方文档
  • 元组
    • 元组
    • 元组是不可变的
    • 包装和拆包元组
    • 内置元组功能
    • 元组是元素明确的可洗和等同的
    • 索引元组
    • 反转元素
  1. StackOverflow 文档
  2. Python Language 教程
  3. 元组
  4. 元组是元素明确的可洗和等同的

元组是元素明确的可洗和等同的

Created: November-22, 2018

hash( (1, 2) )  # ok
hash( ([], {"hello"})  # not ok, since lists and sets are not hashabe

因此,元组可以放在 set 中,也可以作为 dict 中的一个关键字,只有每个元素都可以。

{ (1, 2) } #  ok
{ ([], {"hello"}) ) # not ok
  • 索引元组
  • 内置元组功能

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明