• <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 閱讀(167) 評論(0)  編輯 收藏 引用 所屬分類: Python
            伊人久久综合无码成人网| 精品九九久久国内精品| 久久精品卫校国产小美女| 久久精品国产亚洲AV香蕉| 久久久久久综合一区中文字幕| 国产精品九九久久免费视频 | 国产午夜精品理论片久久影视| 国产精品午夜久久| 久久精品国产亚洲αv忘忧草| 国产91久久综合| 久久夜色精品国产噜噜麻豆 | 一级做a爰片久久毛片16| 久久只这里是精品66| 亚洲国产精品人久久| 狠狠精品久久久无码中文字幕| 色综合久久中文综合网| 中文字幕乱码久久午夜| 日韩影院久久| 狠狠色伊人久久精品综合网 | 国产成人久久精品二区三区| 亚洲乱码精品久久久久.. | 无码国内精品久久人妻| 久久亚洲视频| 久久av高潮av无码av喷吹| 2021精品国产综合久久| 亚洲av成人无码久久精品 | 久久99久久99小草精品免视看 | 亚洲va中文字幕无码久久| 一本色道久久88综合日韩精品 | 成人免费网站久久久| 人妻少妇久久中文字幕| 日韩精品久久无码人妻中文字幕| 一级a性色生活片久久无| 国产精品久久久99| 久久久WWW成人免费精品| 精品久久国产一区二区三区香蕉 | 久久婷婷五月综合色99啪ak| 久久人人爽人人爽人人片AV麻豆 | 久久亚洲国产成人精品性色| 亚洲国产一成人久久精品| 久久婷婷五月综合国产尤物app|