Jafe Lee

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            49 隨筆 :: 0 文章 :: 24 評論 :: 0 Trackbacks
          Example 3.15 Defining a tuple
          1、tuple沒有任何方法
          2、tuple和list可以相互轉(zhuǎn)化
          4、
          Common tuple literals and operations

          Operation

          Interpretation

          ( )

          An empty tuple

          t1 = (0,)

          A one-item tuple (not an expression)

          t2 = (0, 'Ni', 1.2, 3)

          A four-item tuple

          t2 = 0, 'Ni', 1.2, 3

          Another four-item tuple (same as prior line)

          t3 = ('abc', ('def', 'ghi'))

          Nested tuples

          t1[i]t3[i][j]t1[i:j]len(t1)

          Index, slice, length

          t1 + t2t2 * 3

          Concatenate, repeat

          for x in t23 in t2

          Iteration, members


          tuple這些操作和list非常之象。。
          posted on 2007-08-28 21:11 Jafe Lee 閱讀(301) 評論(0)  編輯  收藏 所屬分類: Book Notes--Dive Into Python
          主站蜘蛛池模板: 义乌市| 金阳县| 蓝山县| 疏附县| 永胜县| 禹州市| 宜昌市| 奉节县| 诸暨市| 喜德县| 定西市| 贵溪市| 广东省| 永宁县| 秦皇岛市| 台州市| 洞口县| 永清县| 西和县| 横山县| 新龙县| 珠海市| 青岛市| 濉溪县| 策勒县| 彝良县| 盐津县| 鱼台县| 通州区| 遂溪县| 利川市| 中宁县| 获嘉县| 四平市| 赤水市| 从江县| 深泽县| 安新县| 泰州市| 民县| 天长市|