(1) (http://www.pythontab.com/html/2013/pythonjichu_0128/182.html)
First, analyze the slice operation from the principle:
A slice of the list, inside of which is calling the __getitem__,__setitem__,__delitem__ and slice functions. The slice function is also associated with the range () function.
The key passed to the slice is a special slice object. The object has attributes that describe the orientation of the requested slice, for example:
1 2 3 4 |
A = [1, 2, 3, 4, 5, 6] x = A [1:5] # x = a.__getitem__ (Slice (1, 5, None)) a [1:3] = [One,]# a.__setitem__ (Slice (1, 3, None), [one, one]) del a [1:4]# a.__delitem_ _ (Slice (1, 4, None)) |
Python's slicing capabilities are actually more powerful than many programmers think.
1 |
A = m [0:100:10] # sliced slices with stepping (step value =10) |
Note: Stepping is step
When step > 0 o'clock
Slices from start (including start)