所以我有一个任意长度的数组 . 我想循环它并获取索引及其值等重要信息 . 我想,例如,运行idx = 3..7(4 idxs)的子程序,然后不执行5个idxs,然后再执行idx = 13..17执行等等 .
例如:
array_index=[0,1,2,3,4,5...n]
if idx==3..7:
z=subroutine(x,y)
if idx=8..12:
nothing
if idx=13..17:
z=subroutine(x,y)
and so on....
感谢任何帮助thx!
1 回答
使用
range
(或Python 2中的xrange
)对象列表来执行此操作 .