• <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
            精品国产乱码久久久久久郑州公司| 97久久精品午夜一区二区| 91麻精品国产91久久久久| 亚洲综合婷婷久久| 久久综合视频网站| 香蕉久久av一区二区三区| 99久久人妻无码精品系列蜜桃| 久久精品国产99国产电影网 | 日本一区精品久久久久影院| 国产成人无码精品久久久久免费| 无码任你躁久久久久久久| 最新久久免费视频| 久久久久久久尹人综合网亚洲 | 久久99国产精品久久| 久久国产三级无码一区二区| 亚洲国产欧洲综合997久久| 好久久免费视频高清| 精品人妻伦九区久久AAA片69| 91精品国产综合久久精品| 亚洲国产一成久久精品国产成人综合 | 久久婷婷五月综合色奶水99啪| 国产精品久久久天天影视香蕉| 狠狠色婷婷久久一区二区| 91精品日韩人妻无码久久不卡| 少妇内射兰兰久久| 欧美久久久久久| 欧美色综合久久久久久| 91精品国产91久久| 久久99毛片免费观看不卡 | 久久久无码精品亚洲日韩软件| 国产精品禁18久久久夂久| 人妻无码精品久久亚瑟影视 | 99精品国产在热久久无毒不卡| 综合久久精品色| 一级a性色生活片久久无少妇一级婬片免费放 | 麻豆精品久久久一区二区| 久久超碰97人人做人人爱| 亚洲乱码精品久久久久..| 国产精品亚洲综合久久| 国产精品久久久久久久久软件| 久久青青色综合|