2024-05-17 18:06:57 发布
网友
我使用的是scipy ndimage模块和find_objects函数,它返回一个slice对象。现在我想读取这个slice对象并从中获取开始和结束索引。但是,我找不到办法。在
fragments = ndimage.find_objects(labels) print fragments[0][0] > slice(0L, 832L, None)
如何在python代码中将开始和结束索引存储为变量。在
任何帮助都将不胜感激。提前谢谢。在
^{}的成员是start、step和{}:
start
step
Slice objects have read-only data attributes start, stop and step which merely return the argument values (or their default).
stop
因此简单到:
>>> sl = slice(0L, 832L) >>> sl slice(0L, 832L, None) >>> start = sl.start >>> stop = sl.stop >>> start, stop (0L, 832L)
^{} 的成员是}:
start
、step
和{因此简单到:
相关问题 更多 >
编程相关推荐