【发布时间】:2021-06-19 06:54:06
【问题描述】:
我试图在列表的第一个值和最后一个值之间进行切片。任何人都可以解释以下代码。 其中 index jump 值影响列表并给出输出,如果我不提及 index jump 值它给出空列表。
l = [1, 2, 3, 4, 5, 6, 7]
l[5:-7:-1]
output :- [6, 5, 4, 3, 2] # This is the exact output what i want.
l[5:-7]
output :- []
【问题讨论】:
标签: python-3.6