1.4 python数据类型之list类

类名list

  • 索引: 可以通过索引修改list中元素的值
  • 可迭代: 可以使用for  in  语句循环
  1 def append(self, p_object): # real signature unknown; restored from __doc__
  2         """ 向列表的末尾添加元素 """
  3         """ L.append(object) -> None -- append object to end """
  4         pass
  5 
  6     def clear(self): # real signature unknown; restored from __doc__
  7         """ 清除列表 """
  8         """ L.clear() -> None -- remove all items from L """
  9         pass
 10 
 11     def copy(self): # real signature unknown; restored from __doc__
 12         """ 拷贝列表 浅拷贝 """
 13         """ L.copy() -> list -- a shallow copy of L """
 14         return []
 15 
 16     def count(self, value): # real signature unknown; restored from __doc__
 17         """ 返回子元素出现的次数 """
 18         """ L.count(value) -> integer -- return number of occurrences of value """
 19         return 0
 20 
 21     def extend(self, iterable): # real signature unknown; restored from __doc__
 22         """ x.extend(y) 将y中的元素循环迭代添加到x中"""
 23         """ L.extend(iterable) -> None -- extend list by appending elements from the iterable """
 24         pass
 25 
 26     def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
 27         """ 返回子元素的索引 start为开始位置 end为结束位置 """
 28         """
 29         L.index(value, [start, [stop]]) -> integer -- return first index of value.
 30         Raises ValueError if the value is not present.
 31         """
 32         return 0
 33 
 34     def insert(self, index, p_object): # real signature unknown; restored from __doc__
 35         """ 在指定索引处插入元素 """
 36         """ L.insert(index, object) -- insert object before index """
 37         pass
 38 
 39     def pop(self, index=None): # real signature unknown; restored from __doc__
 40         """ 删除列表中的一个元素,index为要删除元素的索引,默认为最后一个元素 """
 41         """
 42         L.pop([index]) -> item -- remove and return item at index (default last).
 43         Raises IndexError if list is empty or index is out of range.
 44         """
 45         pass
 46 
 47     def remove(self, value): # real signature unknown; restored from __doc__
 48         """ 从列表中删除指定的元素 """
 49         """
 50         L.remove(value) -> None -- remove first occurrence of value.
 51         Raises ValueError if the value is not present.
 52         """
 53         pass
 54 
 55     def reverse(self): # real signature unknown; restored from __doc__
 56         """ 反转列表 """
 57         """ L.reverse() -- reverse *IN PLACE* """
 58         pass
 59 
 60     def sort(self, key=None, reverse=False): # real signature unknown; restored from __doc__
 61         """ 将列表中的元素排序,reverse=False为升序,reverse=True为降序 key是用来比较的参数 """
 62         """ L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* """
 63         pass
 64 
 65     def __add__(self, *args, **kwargs): # real signature unknown
 66         """ 列表的加法运算,只能加一个列表类型的对象 """
 67         """ Return self+value. """
 68         pass
 69 
 70     def __contains__(self, *args, **kwargs): # real signature unknown
 71         """ 是否包含 """
 72         """ Return key in self. """
 73         pass
 74 
 75     def __delitem__(self, *args, **kwargs): # real signature unknown
 76         """ 根据索引删除值 """
 77         """ Delete self[key]. """
 78         pass
 79 
 80     def __eq__(self, *args, **kwargs): # real signature unknown
 81         """ 判断左边的列表是或等于右边的列表 """
 82         """ Return self==value. """
 83         pass
 84 
 85     def __getattribute__(self, *args, **kwargs): # real signature unknown
 86         """ 内部调用__new__方法或传入参数使用 """
 87         """ Return getattr(self, name). """
 88         pass
 89 
 90     def __getitem__(self, y): # real signature unknown; restored from __doc__
 91         """ 根据索引获取值 """
 92         """ x.__getitem__(y) <==> x[y] """
 93         pass
 94 
 95     def __ge__(self, *args, **kwargs): # real signature unknown
 96         """ 判断左边的列表是或大于等于右边的列表 """
 97         """ Return self>=value. """
 98         pass
 99 
100     def __gt__(self, *args, **kwargs): # real signature unknown
101         """ 判断左边的列表是或大于右边的列表 """
102         """ Return self>value. """
103         pass
104 
105     def __iadd__(self, *args, **kwargs): # real signature unknown
106         """ 将原列表进行加法运算后返回给原列表,可以加一个字符串类型或列表类型的对象 """
107         """ Implement self+=value. """
108         pass
109 
110     def __imul__(self, *args, **kwargs): # real signature unknown
111         """ 将列表进行乘法运算后返回给原列表 """
112         """  """
113         """ Implement self*=value. """
114         pass
115 
116     def __init__(self, seq=()): # known special case of list.__init__
117         """ 构造方法,创建列表对象时调用 """
118         """
119         list() -> new empty list
120         list(iterable) -> new list initialized from iterable's items
121         # (copied from class doc)
122         """
123         pass
124 
125     def __iter__(self, *args, **kwargs): # real signature unknown
126         """ 返回这个列表的可迭代对象 """
127         """ Implement iter(self). """
128         pass
129 
130     def __len__(self, *args, **kwargs): # real signature unknown
131         """ 返回列表的长度 """
132         """ Return len(self). """
133         pass
134 
135     def __le__(self, *args, **kwargs): # real signature unknown
136         """ 判断左边的列表是否小于右边的列表 """
137         """ Return self<=value. """
138         pass
139 
140     def __lt__(self, *args, **kwargs): # real signature unknown
141         """  """
142         """ Return self<value. """
143         pass
144 
145     def __mul__(self, *args, **kwargs): # real signature unknown
146         """ 列表的乘法运算 """
147         """ Return self*value.n """
148         pass
149 
150     @staticmethod # known case of __new__
151     def __new__(*args, **kwargs): # real signature unknown
152         """ Create and return a new object.  See help(type) for accurate signature. """
153         pass
154 
155     def __ne__(self, *args, **kwargs): # real signature unknown
156         """ 判断两个列表的值是否不相等 """
157         """ Return self!=value. """
158         pass
159 
160     def __repr__(self, *args, **kwargs): # real signature unknown
161         """ 转换成解释器可读取的形式 """
162         """ Return repr(self). """
163         pass
164 
165     def __reversed__(self): # real signature unknown; restored from __doc__
166         """ 返回反转列表的迭代对象 """
167         """ L.__reversed__() -- return a reverse iterator over the list """
168         pass
169 
170     def __rmul__(self, *args, **kwargs): # real signature unknown
171         """ 列表的乘法运算 """
172         """ Return self*value. """
173         pass
174 
175     def __setitem__(self, *args, **kwargs): # real signature unknown
176         """ 给指定的索引处设定值 """
177         """ Set self[key] to value. """
178         pass
179 
180     def __sizeof__(self): # real signature unknown; restored from __doc__
181         """ 返回在内存中占用的字节数 """
182         """ L.__sizeof__() -- size of L in memory, in bytes """
183         pass
184 
185     __hash__ = None

猜你喜欢

转载自www.cnblogs.com/rodger/p/10657934.html
1.4
今日推荐