• <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精品国产自在现线小黄鸭| 久久丫忘忧草产品| 伊人久久综在合线亚洲2019| 久久久久无码精品| 人妻无码久久一区二区三区免费| 精品免费久久久久久久| 久久久久久国产精品免费免费 | 国产69精品久久久久99尤物| 国产午夜免费高清久久影院| 久久91精品国产91久久麻豆| 色99久久久久高潮综合影院| 久久久久久亚洲精品成人| 国产国产成人久久精品| 国产精品免费福利久久| 国产香蕉久久精品综合网| 精品久久久久久久久午夜福利| 久久精品国产精品亚洲艾草网美妙| 无码精品久久久天天影视| 国产福利电影一区二区三区,免费久久久久久久精 | 久久亚洲天堂| 久久精品女人天堂AV麻| 久久精品国内一区二区三区 | 国内精品综合久久久40p| 日本精品久久久中文字幕| 国内精品久久久久影院老司| 欧美久久久久久精选9999| 国产成人久久777777| 亚洲国产成人久久综合碰碰动漫3d| 伊人久久大香线蕉AV色婷婷色| 2021国产精品久久精品| 超级碰碰碰碰97久久久久| 综合久久精品色| 久久青草国产手机看片福利盒子| 久久天天躁狠狠躁夜夜avapp| 久久精品国产欧美日韩99热| 国内精品伊人久久久影院| 一本久久免费视频| 久久无码高潮喷水| 一本色道久久综合亚洲精品| 精品免费久久久久久久| 日韩精品国产自在久久现线拍|