Subscripts in python start at 0
Take from back to front
Note: The following 2 represents the step size, first look at the value taken out by 2:-1
[Start Position:End Position:Step]
reverse order
But it is found that if [-1:0:-1] finds that the first element cannot be obtained, what should I do?
At this time, just remove the 0 in the middle, and removing it means getting the first element. If it is empty, then by default, the first or last element will be found.