Skip to content

Commit

Permalink
1.切片arr1[:3],是不包括第四个元素 (unknwon#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
liyv authored and unknwon committed Nov 17, 2018
1 parent 3ed4f65 commit e538573
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eBook/07.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

`arr1[2:]``arr1[2:len(arr1)]` 相同,都包含了数组从第三个到最后的所有元素。

`arr1[:3]``arr1[0:3]` 相同,包含了从第一个到第三个元素(不包括第三个)。
`arr1[:3]``arr1[0:3]` 相同,包含了从第一个到第三个元素(不包括第四个)。

如果你想去掉 slice1 的最后一个元素,只要 `slice1 = slice1[:len(slice1)-1]`

Expand Down

0 comments on commit e538573

Please sign in to comment.