• <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
            国产69精品久久久久777| 伊人久久亚洲综合影院| 美女写真久久影院| 久久久久国产精品三级网| 欧美激情一区二区久久久| 国产精品美女久久久久久2018| 国产成人综合久久久久久 | 伊人久久大香线蕉综合网站| 99久久99这里只有免费费精品| 国产精品熟女福利久久AV| 无码八A片人妻少妇久久| 中文字幕久久欲求不满| 亚洲AV无码1区2区久久| 欧美午夜A∨大片久久| 久久99精品久久久久婷婷| 久久精品桃花综合| 国产精品gz久久久| 成人久久综合网| 久久久久久国产精品无码超碰| 亚洲精品99久久久久中文字幕| 国产激情久久久久影院小草| 欧美大香线蕉线伊人久久| 2020国产成人久久精品| 色8激情欧美成人久久综合电| 国产成人久久精品二区三区| 狠狠色丁香久久婷婷综| 97久久超碰国产精品旧版| 久久久国产乱子伦精品作者| 亚洲AV无码成人网站久久精品大| 欧美日韩精品久久久久| 伊人久久大香线蕉AV一区二区| 久久久久香蕉视频| 国产香蕉97碰碰久久人人| 成人午夜精品久久久久久久小说| 色综合久久天天综合| 国产精品午夜久久| 久久高潮一级毛片免费| 亚洲精品综合久久| 成人午夜精品无码区久久| 人妻无码αv中文字幕久久| 久久99国产精品一区二区|