• <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
            久久久精品视频免费观看| 无码AV中文字幕久久专区| 国产精品热久久毛片| 久久国产综合精品五月天| 久久99精品久久久久久水蜜桃| 亚洲婷婷国产精品电影人久久| 亚洲香蕉网久久综合影视| 国产精品女同久久久久电影院| 99久久精品国产一区二区蜜芽| 久久精品中文无码资源站| 久久免费小视频| 国内精品综合久久久40p| 精品国产一区二区三区久久| 内射无码专区久久亚洲| 国产成人精品免费久久久久| 亚洲人AV永久一区二区三区久久| 久久夜色精品国产噜噜亚洲AV| 久久精品国产色蜜蜜麻豆| 999久久久无码国产精品| 久久久久亚洲av成人网人人软件 | 久久99精品久久久久久噜噜| 国产精品久久久香蕉| 久久精品国产亚洲7777| 色综合久久88色综合天天| 香蕉久久av一区二区三区| 久久精品综合网| 色婷婷综合久久久久中文字幕 | 色综合久久久久综合体桃花网| 久久精品国产亚洲Aⅴ香蕉| 国产三级观看久久| 色综合合久久天天综合绕视看| 国产精品久久久久久搜索| 精品久久久噜噜噜久久久 | 久久国产精品久久久| 热re99久久精品国99热| 无码日韩人妻精品久久蜜桃| 青青草原综合久久大伊人导航| 久久青青草原精品国产软件| 久久久久女教师免费一区| 久久亚洲av无码精品浪潮| 久久综合久久伊人|