• <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++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              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 閱讀(161) 評論(0)  編輯 收藏 引用 所屬分類: Python
            亚洲嫩草影院久久精品| 久久天堂AV综合合色蜜桃网| 精品久久人人妻人人做精品| 91亚洲国产成人久久精品网址| 狠狠色综合久久久久尤物| 2021国产精品午夜久久| 精品久久久久久久无码 | 麻豆国内精品久久久久久| 午夜精品久久久久久影视riav| 久久婷婷国产综合精品 | 久久久久亚洲精品男人的天堂| 久久久久久久波多野结衣高潮| 亚洲乱亚洲乱淫久久| 一本色道久久99一综合| 精品熟女少妇aⅴ免费久久| 欧美噜噜久久久XXX| 无码人妻少妇久久中文字幕| 国产精品天天影视久久综合网| 中文成人无码精品久久久不卡| 国内精品九九久久久精品| 久久午夜福利无码1000合集| 国产亚州精品女人久久久久久 | 成人综合久久精品色婷婷| 国产精品热久久毛片| 久久精品国产99久久无毒不卡 | 精品综合久久久久久88小说| 日日噜噜夜夜狠狠久久丁香五月| 无码任你躁久久久久久久| 久久国产精品一区| 97精品国产97久久久久久免费| 99久久无色码中文字幕人妻| 久久久久久国产a免费观看黄色大片| 国产精品美女久久久网AV| 久久精品嫩草影院| 九九久久自然熟的香蕉图片| 久久久久亚洲av无码专区| 色8久久人人97超碰香蕉987| 久久无码中文字幕东京热| 亚洲精品美女久久久久99| 久久夜色精品国产噜噜麻豆| 精品久久久噜噜噜久久久|