• <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
            国产偷久久久精品专区 | 精品久久久久久无码国产| 国产99久久久国产精品小说| 99精品久久精品| 免费一级做a爰片久久毛片潮| 久久99亚洲网美利坚合众国| 国产激情久久久久影院老熟女免费 | 很黄很污的网站久久mimi色| 久久亚洲国产欧洲精品一| 国产精品女同一区二区久久| 中文字幕精品无码久久久久久3D日动漫 | 91久久精品91久久性色| 久久精品国产色蜜蜜麻豆| 精品久久久久久国产| 色综合久久综精品| 久久婷婷激情综合色综合俺也去| 婷婷五月深深久久精品| 国产三级观看久久| 久久er国产精品免费观看2| 亚洲精品无码久久久| 91久久精品视频| 99久久国产热无码精品免费| 久久综合九色欧美综合狠狠 | 久久中文精品无码中文字幕| 蜜臀av性久久久久蜜臀aⅴ麻豆 | 久久国产乱子伦精品免费午夜| 亚洲人成网站999久久久综合| 日产精品99久久久久久| 国产精品一区二区久久精品无码 | 久久久久亚洲精品日久生情| 国产99久久九九精品无码| 偷窥少妇久久久久久久久| 国产香蕉97碰碰久久人人| 久久久久综合网久久| 久久91精品国产91久久户| 久久AV高清无码| 国产精品久久久久久影院| 久久精品九九亚洲精品| 婷婷伊人久久大香线蕉AV| 人妻无码中文久久久久专区| 久久天天躁狠狠躁夜夜网站|