• <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 閱讀(161) 評論(0)  編輯 收藏 引用 所屬分類: Python
            一本色道久久88综合日韩精品 | 亚洲成av人片不卡无码久久| 精品久久久久久久久中文字幕| 亚洲综合伊人久久大杳蕉| 久久人人爽爽爽人久久久| 久久精品国产亚洲AV大全| 久久久久四虎国产精品| 久久久无码精品亚洲日韩按摩| 国产精品一久久香蕉国产线看| 一级做a爱片久久毛片| 久久婷婷午色综合夜啪| 精品免费久久久久久久| 久久精品国产亚洲7777| 午夜精品久久久久久99热| 国产农村妇女毛片精品久久| 久久亚洲AV无码精品色午夜麻豆| 2021国产精品久久精品| 91精品国产91久久| 亚洲AV无码1区2区久久| 久久精品中文字幕久久| 欧美激情精品久久久久久| 精品久久久久久亚洲| 精品久久久久久久国产潘金莲| 99久久99久久| 国内精品久久久久影院网站| 日韩精品久久久久久免费| 麻豆久久久9性大片| 久久久久国产精品麻豆AR影院| 久久夜色精品国产噜噜亚洲AV | 久久免费看黄a级毛片| 香蕉久久夜色精品国产小说| 久久精品夜夜夜夜夜久久| 亚洲国产精品嫩草影院久久 | 久久只有这精品99| 99精品国产免费久久久久久下载| 大美女久久久久久j久久| 国产三级久久久精品麻豆三级| 99久久精品免费观看国产| 久久精品水蜜桃av综合天堂| 无码人妻久久一区二区三区 | 色偷偷88欧美精品久久久|