Jafe Lee

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            49 隨筆 :: 0 文章 :: 24 評論 :: 0 Trackbacks
          Example 3.15 Defining a tuple
          1、tuple沒有任何方法
          2、tuple和list可以相互轉化
          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 閱讀(293) 評論(0)  編輯  收藏 所屬分類: Book Notes--Dive Into Python
          主站蜘蛛池模板: 江西省| 兴义市| 旬邑县| 尼勒克县| 黄平县| 南丰县| 万盛区| 定西市| 综艺| 温州市| 涿州市| 隆化县| 宁城县| 元氏县| 玛曲县| 池州市| 额济纳旗| 和政县| 岚皋县| 霍山县| 藁城市| 莆田市| 河北区| 平度市| 观塘区| 新丰县| 绥芬河市| 神农架林区| 电白县| 宜兰县| 葫芦岛市| 泾川县| 江华| 兴海县| 会泽县| 雅江县| 汕尾市| 中山市| 荥阳市| 连城县| 漾濞|