• <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++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              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 閱讀(164) 評論(0)  編輯 收藏 引用 所屬分類: Python
            亚洲精品国精品久久99热| 7777精品久久久大香线蕉| 亚洲va久久久噜噜噜久久天堂| 久久丝袜精品中文字幕| 尹人香蕉久久99天天拍| 免费观看久久精彩视频| 91视频国产91久久久| 久久综合久久鬼色| 综合久久给合久久狠狠狠97色| 亚洲精品国产综合久久一线| 亚洲精品国产自在久久| 欧美牲交A欧牲交aⅴ久久| 国产精品日韩深夜福利久久 | 国产精品无码久久久久久| 久久精品国产亚洲沈樵| 久久精品中文无码资源站| 青青草原综合久久| 看久久久久久a级毛片| 日批日出水久久亚洲精品tv| 久久精品国产亚洲77777| 久久精品亚洲乱码伦伦中文| WWW婷婷AV久久久影片| 亚洲中文字幕久久精品无码APP | 亚洲欧美一级久久精品| 久久国产精品-国产精品| 性欧美大战久久久久久久久| 四虎久久影院| 性做久久久久久免费观看| 久久国产高清一区二区三区| 国产午夜精品久久久久免费视 | 理论片午午伦夜理片久久| 久久亚洲中文字幕精品有坂深雪 | 18岁日韩内射颜射午夜久久成人| 国内精品久久久久影院日本| 伊人久久大香线蕉AV一区二区| 伊人精品久久久久7777| 亚洲欧洲中文日韩久久AV乱码| 久久这里有精品视频| 久久免费视频一区| 亚洲人成电影网站久久| 99久久国产宗和精品1上映 |