Change and delete
Increase
The X.append function is to append a new element to the list at the end of the original list
X.extend () Adds a list of elements to another list, keeps the referenced original list intact, and extend can also be applied to tuples, dictionaries, collections ...
X.insert (subscript, Element) insert adds an element at a specified position based on the subscript
By deleting:
X.remove ("content") add a specific element to delete, only 1 elements can be deleted at a time, if a list of multiple duplicate elements, will be deleted from left to right found the first element to meet the deletion criteria
X.pop (subscript) deletes the element corresponding to the subscript according to the list subscript and returns the value of the deleted element (the return value needs to be received using the variable)
Del x[0] del can delete an element based on the slice subscript in the list, and Del clears all elements of the entire list if it is not given the subscript to be deleted.
X.clear () empties the entire list so that the list element value is empty
Change:
x[0]= "One" modifies or replaces elements in a list, which can be replaced and modified in the form of a slice assignment
Check:
X.index () returns the subscript based on the element, if multiple repeating elements appear in the list, the first element that is found from left to right is returned subscript
In/not in
Finds whether an element exists in the list or does not exist, the return value is a Boolean value Ture/false
COUNT () query the number of duplicates in an element in the list
Python list Knowledge points explained