• <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
            国产日产久久高清欧美一区| 国产L精品国产亚洲区久久| 久久99精品久久久大学生| 久久久久亚洲精品日久生情| 漂亮人妻被黑人久久精品| 久久国产视频99电影| 伊人久久大香线蕉av不卡| 777久久精品一区二区三区无码 | 久久99热这里只有精品国产| 久久久精品人妻一区二区三区蜜桃| 日本免费久久久久久久网站| 99久久香蕉国产线看观香| 日本精品久久久久中文字幕| 久久人人爽人人爽人人片AV高清| 久久免费高清视频| 中文字幕日本人妻久久久免费| 久久综合久久久| 久久精品中文字幕无码绿巨人| 亚洲午夜福利精品久久| 成人精品一区二区久久| 国产亚洲婷婷香蕉久久精品| 亚洲国产精品无码久久SM| 麻豆久久久9性大片| 精品久久久久久久中文字幕| 久久99国产亚洲高清观看首页 | 2021最新久久久视精品爱| 久久精品亚洲福利| 99久久精品免费| 久久精品国产亚洲网站| 无码专区久久综合久中文字幕| 伊人久久精品影院| 国产精品久久新婚兰兰| 国产精品中文久久久久久久| 国产精品久久久久久五月尺| 日韩中文久久| 欧美精品九九99久久在观看| 2020久久精品亚洲热综合一本| 最新久久免费视频| 亚洲AV无码1区2区久久| 久久久免费精品re6| 国产精品久久久久久久|