zoukankan      html  css  js  c++  java
  • python deque

    Deque objects support the following methods:

    append(x)

    Add x to the right side of the deque.

    appendleft(x)

    Add x to the left side of the deque.

    clear()

    Remove all elements from the deque leaving it with length 0.

    copy()

    Create a shallow copy of the deque.

    New in version 3.5.

    count(x)

    Count the number of deque elements equal to x.

    New in version 3.2.

    extend(iterable)

    Extend the right side of the deque by appending elements from the iterable argument.

    extendleft(iterable)

    Extend the left side of the deque by appending elements from iterable. Note, the series of left appends results in reversing the order of elements in the iterable argument.

    index(x[, start[, stop]])

    Return the position of x in the deque (at or after index start and before index stop). Returns the first match or raises ValueError if not found.

    New in version 3.5.

    insert(ix)

    Insert x into the deque at position i.

    If the insertion would cause a bounded deque to grow beyond maxlen, an IndexError is raised.

    New in version 3.5.

    pop()

    Remove and return an element from the right side of the deque. If no elements are present, raises an IndexError.

    popleft()

    Remove and return an element from the left side of the deque. If no elements are present, raises an IndexError.

    remove(value)

    Remove the first occurrence of value. If not found, raises a ValueError.

    reverse()

    Reverse the elements of the deque in-place and then return None.

    New in version 3.2.

    rotate(n=1)

    Rotate the deque n steps to the right. If n is negative, rotate to the left.

    When the deque is not empty, rotating one step to the right is equivalent to d.appendleft(d.pop()), and rotating one step to the left is equivalent to d.append(d.popleft()).

    Deque objects also provide one read-only attribute:

    maxlen

    Maximum size of a deque or None if unbounded.

  • 相关阅读:
    关于vue2.x使用axios以及http-proxy-middleware代理处理跨域的问题
    vue-resource的使用
    从头开始开发一个vue幻灯片组件
    图与例解读Async/Await
    浅谈web缓存
    APICloud框架——总结一下最近开发APP遇到的一些问题 (三)
    编写现代 CSS 代码的 20 个建议
    仿微信联系人列表滑动字母索引
    初来乍到,向各位大牛虚心学习
    转发80端口的脚本
  • 原文地址:https://www.cnblogs.com/zle1992/p/10282870.html
Copyright © 2011-2022 走看看