• python之列表


    def append(self, p_object): # real signature unknown; restored from __doc__
    """
    L.append(object) -> None -- append object to end
    在列表尾部追加元素
    """
    pass
    eg:



    def clear(self): # real signature unknown; restored from __doc__
    """
    L.clear() -> None -- remove all items from L
    清除列表中的元素
    """
    pass
    eg:



    def copy(self): # real signature unknown; restored from __doc__
    """
    L.copy() -> list -- a shallow copy of L
    列表的浅拷贝
    """
    return []

    def count(self, value): # real signature unknown; restored from __doc__
    """
    L.count(value) -> integer -- return number of occurrences of value
    统计列表中指定元素个数
    """
    return 0
    eg:




    def extend(self, iterable): # real signature unknown; restored from __doc__
    """
    L.extend(iterable) -> None -- extend list by appending elements from the iterable
    对列表元素进行扩展
    """
    pass

    eg:


    def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
    """
    L.index(value, [start, [stop]]) -> integer -- return first index of value.
    Raises ValueError if the value is not present.
    返回指定值的索引值
    """
    return 0

    eg:


    def insert(self, index, p_object): # real signature unknown; restored from __doc__
    """
    L.insert(index, object) -- insert object before index
    列表中指定位置插入相关的值
    """
    pass
    eg:



    def pop(self, index=None): # real signature unknown; restored from __doc__
    """
    L.pop([index]) -> item -- remove and return item at index (default last).
    Raises IndexError if list is empty or index is out of range.
    指定索引弹出相关元素,如果不指定索引会从最后一个弹出,如果指定变量,该变量会接收弹出值
    """
    pass
    eg:



    def remove(self, value): # real signature unknown; restored from __doc__
    """
    L.remove(value) -> None -- remove first occurrence of value.
    Raises ValueError if the value is not present.
    删除列表中指定值的元素
    """
    pass
    eg:



    def reverse(self): # real signature unknown; restored from __doc__
    """
    L.reverse() -- reverse *IN PLACE*
    把列表中的元素反转
    """
    pass
    eg:



    def sort(self, key=None, reverse=False): # real signature unknown; restored from __doc__
    """
    L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE*
    对列表中的元素进行排序,默认reverse=False按升序排序,如果reverse=True 按降序排序
    """
    pass
    eg:

    
    
  • 相关阅读:
    linux下解除端口占用
    设计模式(二)观察者模式
    设计模式(一) 策略模式
    loj #6235. 区间素数个数
    loj #2013. 「SCOI2016」幸运数字
    loj #6014. 「网络流 24 题」最长 k 可重区间集
    loj #6013. 「网络流 24 题」负载平衡
    loj #2255. 「SNOI2017」炸弹
    loj #2051. 「HNOI2016」序列
    loj #6122. 「网络流 24 题」航空路线问题
  • 原文地址:https://www.cnblogs.com/baotouzhangce/p/6136293.html
Copyright © 2020-2023  润新知