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 閱讀(293) 評論(0)  編輯  收藏 所屬分類: Book Notes--Dive Into Python
          主站蜘蛛池模板: 柳州市| 明星| 青岛市| 云安县| 铜川市| 屯留县| 兴和县| 米泉市| 郸城县| 石台县| 临沭县| 买车| 宜兰县| 沙洋县| 武邑县| 康定县| 敦化市| 高陵县| 临江市| 驻马店市| 宿迁市| 天峨县| 奎屯市| 饶阳县| 连江县| 舒城县| 进贤县| 岳阳县| 蒲江县| 道孚县| 常宁市| 洪湖市| 明溪县| 通化市| 奎屯市| 冷水江市| 乌拉特前旗| 通城县| 蛟河市| 隆子县| 遂平县|