python中的slice用法
同事在网上做题碰到的
>>> items = [0,1,2,3,4,5,6,7,8,9]
>>> a = _____(2,4)
>>> items[2:4]
[2, 3]
>>> items[a]
[2, 3]
前段时间看cookbook刚好碰到过:slice对切片命名
a = slice(2,4)
同事在网上做题碰到的
>>> items = [0,1,2,3,4,5,6,7,8,9]
>>> a = _____(2,4)
>>> items[2:4]
[2, 3]
>>> items[a]
[2, 3]
前段时间看cookbook刚好碰到过:slice对切片命名
a = slice(2,4)