• <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 閱讀(166) 評論(0)  編輯 收藏 引用 所屬分類: Python
            久久99国产精品99久久| 中文精品99久久国产| 狠狠色婷婷综合天天久久丁香| 久久AV高清无码| 久久精品成人免费观看97| 久久久久久精品免费免费自慰| 久久精品国产精品亚洲毛片 | 国产成人久久精品区一区二区| 国产精品一区二区久久| 中文字幕精品久久| 亚洲国产成人久久综合一| 伊人久久大香线蕉综合影院首页| 亚洲成人精品久久| 久久久国产乱子伦精品作者| 少妇久久久久久被弄到高潮 | 国内精品久久久人妻中文字幕| 久久午夜福利电影| 国产一久久香蕉国产线看观看| 久久精品国产亚洲AV不卡| 久久久久久毛片免费看| 久久精品成人免费网站| 色88久久久久高潮综合影院| 亚洲欧洲精品成人久久奇米网| 国产—久久香蕉国产线看观看 | 久久久久久久波多野结衣高潮| 97精品国产97久久久久久免费| 久久精品国产亚洲av影院| av色综合久久天堂av色综合在 | 一本久久精品一区二区| 国产精品亚洲综合专区片高清久久久| 性欧美丰满熟妇XXXX性久久久 | 狠狠色丁香久久婷婷综合五月 | 精品久久人人爽天天玩人人妻| 97久久天天综合色天天综合色hd | 国产精品亚洲美女久久久| www亚洲欲色成人久久精品| 亚洲国产精品久久久久网站| 久久国产精品成人免费| www亚洲欲色成人久久精品| 99久久成人18免费网站| 久久久久国产亚洲AV麻豆|