The same 3 types that share the indexing operator (str
,
bytes
, and arrays) also share the ability to cut out a
slice of values between given two indexes. The operator
returns all the elements starting with the first index value
given and up to, but not including the second index value:
If a negative value is given as an index, it is interpreted to indicate an element relative to the end of the string or array: