magic-python icon indicating copy to clipboard operation
magic-python copied to clipboard

c01/c01_24

Open utterances-bot opened this issue 3 years ago • 2 comments

1.24 时有时无的切片异常 — Python黑魔法手册 1.0.0 documentation

https://magic.iswbm.com/c01/c01_24.html

utterances-bot avatar Jul 14 '22 00:07 utterances-bot

類似於

>>> alist = [0, 1, 2, 3, 4]
>>> alist[:100]
[0, 1, 2, 3, 4]

EvanHsieh0415 avatar Jul 14 '22 00:07 EvanHsieh0415

在切片里 list[a:b] 如果a或者b大于列表长度 则默认改成列表长度 如果a>b 就让b会把b改成跟a相等 印象中是这样

yie1d avatar Aug 02 '22 06:08 yie1d