Python:切片与指数的用法

  

  

<强>,

        在祝辞祝辞e=[0, 1, 2, 3, 4, 5, 6)      在祝辞祝辞s=片(2、3)      在祝辞祝辞e [s]      [2]      片的区间左闭右开()      在祝辞祝辞      片(2、3、没有)      片([strar]停止[,]),开始缺少时就是0   之前      

  

<强>,

        在祝辞祝辞print (s.indices (100))      (2、3、1)      在祝辞祝辞print (s.indices (3))      (2、3、1)      在祝辞祝辞print (s.indices (2))      (2、2、1)      在祝辞祝辞e [s]      [2]   之前      

这个指数相当于停止的位置,只要是大于之前的停止索引,按之前的来,否则就取小索引

  

以上这篇Python:切片与指数的用法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

Python:切片与指数的用法