A very simple way to remove elements in lists and tuples in python is to use slices
Slice usage
For example, to go to L[0:3]
him means to go from the 0 index to the 3 index, but does not include the 3 index, if the first index is 0, it can also be written in L[:3]
this way
slice from behind
The method used L[-1]
is to take the last element. We need to remember that the index of the last element is -1.
Python does not have a function for string interception. It is very simple to complete the string interception by using slices.