Arrays can be sliced just like lists and tuples. Array slicing is identical to list slicing, except that the syntax is simpler. Arrays are sliced using the
[ : , :, ... :] syntax, where the number of dimensions of the arrays determine the size of the slice, except that these dimensions for which slices are omitted, all elements are selected. For example, if
b is a three-dimensional array,
b[0:2] is the same as
b[0:2,:,:]. There are shorthand notations for slicing. Some common ones are:
All these slicing methods have been referenced ...