來至builtins.py:app
def extend(self, iterable): # real signature unknown; restored from __doc__
""" L.extend(iterable) -> None -- extend list by appending elements from the iterable """
pas
#把iterable裏的元素一個一個的追加到列表後面。
def append(self, p_object): # real signature unknown; restored from __doc__
""" L.append(object) -> None -- append object to end """
pass
#把object直接追加到列表後面。
extent和append的對好比下:
1 a=[1] 2 b=[1] 3 a.append(2) 4 try: 5 b.extend(2) 6 except(TypeError): 7 print("類型錯誤") 8 print("a=",a) 9 print("b=",b) 10 a.append([3,4]) 11 b.extend([3,4]) 12 print("a=",a) 13 print("b=",b)
其結果爲:ui
類型錯誤 a= [1, 2] b= [1] a= [1, 2, [3, 4]] b= [1, 3, 4]
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
#刪除索引位置的元素,第一個元素的全部爲0,默認刪除最後一個元素。