小编kan*_*hka的帖子

在Python中切片列表

我是Python的新手,有人可以告诉我这两个代码块的输出之间的区别:

1.

>> example = [1, 32, 1, 2, 34]
>> example[4:0] = [122]
>> example
[1, 32, 1, 2, 122, 34]
Run Code Online (Sandbox Code Playgroud)

2.

>> example = [1, 32, 1, 2, 34]
>> example[4:1] = [122] 
>> example
[1, 32, 1, 2, 122, 34]
Run Code Online (Sandbox Code Playgroud)

python python-2.7

6
推荐指数
2
解决办法
109
查看次数

标签 统计

python ×1

python-2.7 ×1