• <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
            久久狠狠爱亚洲综合影院| 94久久国产乱子伦精品免费| 日韩欧美亚洲综合久久影院Ds | 国产精品美女久久久久网| 看久久久久久a级毛片| 91精品国产9l久久久久| 久久国产精品二国产精品| 无码精品久久一区二区三区| 少妇精品久久久一区二区三区| 久久91精品国产91久久麻豆| 久久青青草视频| 精品久久久久一区二区三区| 人妻少妇久久中文字幕一区二区 | 亚洲综合精品香蕉久久网97| 伊人久久亚洲综合影院| 青青草原综合久久| 久久丫精品国产亚洲av不卡| 亚洲国产日韩综合久久精品| 亚洲国产精品久久久久网站| 人妻无码αv中文字幕久久| 精品久久久一二三区| 亚洲国产精品婷婷久久| 嫩草伊人久久精品少妇AV| 免费精品国产日韩热久久| 久久久久99精品成人片 | 亚洲国产精品无码久久青草| 青青草国产成人久久91网| 久久精品国产第一区二区三区| 亚洲精品无码专区久久同性男| 香港aa三级久久三级| 久久精品国产亚洲综合色| 久久不见久久见免费视频7| 97精品伊人久久大香线蕉| 久久综合久久综合亚洲| 午夜精品久久久久9999高清| 久久亚洲色一区二区三区| 精品久久久久久无码人妻热| 久久黄视频| 亚洲国产视频久久| 久久久久久久精品成人热色戒| 少妇无套内谢久久久久|