[fontsize=\relsize{-2},numbers=left]
>>> x = [5,12,13,200]
>>> x
[5, 12, 13, 200]
>>> x.append(-2)
>>> x
[5, 12, 13, 200, -2]
>>> del x[2]
>>> x
[5, 12, 200, -2]
>>> z = x[1:3] # array "slicing": elements 1 through 3-1 = 2
>>> z
[12, 200]
>>> yy = [3,4,5,12,13]
>>> yy[3:] # all elements starting with index 3
[12, 13]
>>> yy[:3] # all elements up to but excluding index 3
[3, 4, 5]
就是不太明白中括号里的冒号是对X集合做什么处理,请赐教装过,都成功运行编写程序)
元芳怎么了
米琪卡哇伊
万千封印
相关分类