• <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
            久久91精品国产91久久小草| 亚洲va久久久久| 伊人久久综合成人网| 久久久久久毛片免费看| 久久国产香蕉一区精品| 久久精品国产清自在天天线| 精品乱码久久久久久夜夜嗨| 国产农村妇女毛片精品久久| 精品人妻伦九区久久AAA片69| 狠狠综合久久综合中文88| 久久乐国产精品亚洲综合| 亚洲天堂久久久| 欧美va久久久噜噜噜久久| 99久久精品费精品国产一区二区| WWW婷婷AV久久久影片| 成人精品一区二区久久 | 亚洲AV伊人久久青青草原| 欧美成a人片免费看久久| 久久精品国产亚洲AV不卡| 亚洲精品无码久久久久sm| 国产精品久久久久9999| 久久66热人妻偷产精品9| 日本精品久久久中文字幕| 久久久久久噜噜精品免费直播| 日韩精品久久久久久久电影| 久久婷婷五月综合国产尤物app| 国产精品美女久久久久网| 久久国产免费| 久久久久久无码Av成人影院| 94久久国产乱子伦精品免费| 伊人久久大香线蕉综合热线| 精品久久久久久国产潘金莲| 人妻无码精品久久亚瑟影视| 久久婷婷成人综合色综合| 久久午夜无码鲁丝片午夜精品| 一本一本久久a久久综合精品蜜桃| 伊人久久综在合线亚洲2019 | 伊人久久大香线蕉av一区| 亚洲国产成人久久精品动漫| 99久久国产亚洲综合精品| 日韩一区二区久久久久久 |