Python List Method
Def append (self, p_object) # append to the end of the list
Def clear (self): # delete all elements in the list
Def copy (self) # list copying
Def count (self, value) # returns the number of times a list element appears.
Def extend (self, iterable) # Same as for loop, can be iterated.
Example:
Li = ['A', 'B', 'C', 'D'] l = ['E', 'F'] li. extend (l) print (li) ['A', 'B', 'C', 'D', 'E', 'F'] # return results
Def index (self, value, start = None, stop = None) # Return the index location of the corresponding value through the value parameter.
Def insert (self, index, p_object) # insert an element at a specified position
Example:
Li. insert (2, 'Hello') # indicates that the value 'Hello' is inserted after 2nd elements'
Def pop (self, index = None) # It is deleted by default. If no element in the list is displayed, an error is returned.
Def remove (self, value) # When multiple identical values appear in the list, delete the first
L. remove (value)-> None -- remove first occurrence of value.
Def reverse (self) # reverse the list element
"L. reverse () -- reverse * in place *"""
Def sort (self, key = None, reverse = False) # sort
""" L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* """