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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章