0
what are slices in arrays
slices
3 Antworten
+ 5
Just an annotation: you can use slices as independent objects in python.
a = [1, 2, 3, 4]
b = (5, 6, 7, 8)
sl = slice(-2, None, 1) # last two items, equivalent to [-2::1]
print(a[sl]) # output: [3, 4]
print(b[sl]) # output: (7, 8)
+ 1
Generally the "slices in array" concept is being dealt in perl scripting language.