• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Welcome to 陳俊峰's ---BeetleHeaded Man Blog !

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              58 隨筆 :: 32 文章 :: 18 評論 :: 0 Trackbacks

            Python Reading Notes : (2006-4-13)
            Note One : the powerful Lists

            Using Lists as Stacks
            ?
            To add an item to the top of the stack, use append() ,To retrieve an item from the top of the stack, use pop() without an explicit index. For example:
            >>> stack = [3, 4, 5]
            >>> stack.append(6)
            >>> stack.append(7)
            >>> stack
            [3, 4, 5, 6, 7]
            >>> stack.pop()
            7
            >>> stack
            [3, 4, 5, 6]
            >>> stack.pop()
            6
            >>> stack.pop()
            5
            >>> stack
            [3, 4]

            Using Lists as Queues


            To add an item to the back of the queue, use append() To retrieve an item from the front of the queue, use pop() with 0 as the index. For example:
            >>> queue = ["Eric", "John", "Michael"]
            >>> queue.append("Terry")?????????? # Terry arrives
            >>> queue.append("Graham")????????? # Graham arrives
            >>> queue.pop(0)
            'Eric'
            >>> queue.pop(0)
            'John'
            >>> queue
            ['Michael', 'Terry', 'Graham']

            Note?Two :about Tuples (distinguish between string type and? tuples tpye,especially?zero or only one items contained in a tuples?)

            A special problem is the construction of tuples containing 0 or 1 items: the syntax has some extra quirks to accommodate these. Empty tuples are constructed by an empty pair of parentheses; a tuple with one item is constructed by following a value with a comma (it is not sufficient to enclose a single value in parentheses). Ugly, but effective. For example:
            >>> empty = ()
            >>> singleton = 'hello',??? # <-- note trailing comma
            >>> len(empty)
            0
            >>> len(singleton)
            1
            >>> singleton
            ('hello',)


            but if you write a statement like this :
            >>> singleton = 'hello'????????? # it means that you define or construct a string type,not a tuples
            >>>?singleton
            'hello'
            ?


            posted on 2006-04-13 11:26 Jeff-Chen 閱讀(166) 評論(0)  編輯 收藏 引用 所屬分類: Python
            香蕉久久夜色精品国产尤物| 久久天天躁狠狠躁夜夜av浪潮| 久久久久亚洲AV片无码下载蜜桃| 97精品伊人久久大香线蕉| 7777久久久国产精品消防器材| 久久国产亚洲高清观看| 99热精品久久只有精品| 久久亚洲精品国产精品婷婷| 99久久人妻无码精品系列| 久久久精品日本一区二区三区 | 精品视频久久久久| 久久久国产视频| 激情五月综合综合久久69| 色婷婷久久综合中文久久蜜桃av| www亚洲欲色成人久久精品| 久久久久久久97| 久久这里只有精品视频99| 国产精品岛国久久久久| 亚洲午夜久久久久久噜噜噜| 人人狠狠综合88综合久久| 精品免费tv久久久久久久| 久久久久久国产精品无码超碰| 久久这里的只有是精品23| 久久激情亚洲精品无码?V| 久久99中文字幕久久| 国产精品99久久免费观看| 青草国产精品久久久久久| 亚洲色欲久久久综合网| 欧美伊人久久大香线蕉综合| 久久99精品久久久久久秒播| 久久91精品久久91综合| 久久久青草久久久青草| 久久综合丝袜日本网| 一本色道久久88加勒比—综合| 国产产无码乱码精品久久鸭 | 国产午夜福利精品久久| 99久久中文字幕| 久久综合中文字幕| 久久99精品国产99久久6| 国产香蕉97碰碰久久人人| 青草久久久国产线免观|