首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
python步进切片
python步进切片
mac
2025-08-22
2
步进切片 sequence[起始索引,结束索引,步进值] l
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
#反向切片有倒序效果
#步长为1
l
[
:
:
-
1
]
Out
:
[
7
,
6
,
5
,
4
,
3
,
2
,
1
]
l
[
:
:
1
]
Out
:
[
1
,
2
,
3
,
4
,
5
,
6
,
7
]
#步长为2
l
[
:
:
-
2
]
Out
:
[
7
,
5
,
3
,
1
]
l
[
:
:
2
]
Out
:
[
1
,
3
,
5
,
7
]
转载请注明原文地址: https://mac.8miu.com/read-505791.html
最新回复
(
0
)