📜  python 切片数组 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.324000             🧑  作者: Mango

代码示例1
a[start:stop]  # items start through stop-1
a[start:]      # items start through the rest of the array
a[:stop]       # items from the beginning through stop-1
a[:]           # a copy of the whole array
Example:
>>> a = [1, 2, 3, 4, 5, 6, 7, 8]
>>> a[1:4]
[2, 3, 4]