• <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 閱讀(164) 評論(0)  編輯 收藏 引用 所屬分類: Python
            亚洲精品国产第一综合99久久| 999久久久无码国产精品| 品成人欧美大片久久国产欧美... 品成人欧美大片久久国产欧美 | 亚洲va久久久噜噜噜久久狠狠| 日韩精品久久无码人妻中文字幕| 久久99国产精品久久99果冻传媒| 国产 亚洲 欧美 另类 久久| 亚洲欧美久久久久9999| 99久久99久久| 日韩美女18网站久久精品| 日日狠狠久久偷偷色综合免费| 久久人人爽人人爽人人片AV麻烦 | 久久精品亚洲男人的天堂| 久久中文字幕精品| 久久99国产精品久久久| 国内精品久久久久影院薰衣草| 国产精品美女久久久久av爽| 久久精品国产亚洲av影院| 久久有码中文字幕| 一本色道久久88加勒比—综合| 天堂无码久久综合东京热| 99久久99久久精品国产片| 欧洲人妻丰满av无码久久不卡| 久久人人爽人人爽人人片AV麻豆| 成人久久久观看免费毛片| 亚洲欧美日韩久久精品第一区| 亚洲国产成人久久综合碰碰动漫3d | 国内精品久久久久影院薰衣草| 久久精品这里只有精99品| 久久精品这里热有精品| 国内精品久久久久影院一蜜桃| 亚洲日韩中文无码久久| 久久人人爽人人人人片av| 久久精品国产只有精品66| 伊人久久大香线蕉影院95| 亚洲精品高清久久| 热久久这里只有精品| 狠狠久久综合| 免费一级欧美大片久久网| 久久久久久国产精品无码下载| 久久精品免费大片国产大片|