
1 O21 Jul 17, 2014 for i in range(10): print i 这样写比较简单吧。。 |
2 puyo Jul 17, 2014 list.pop([i]) Remove the item at the given position in the list, and return it. 懂了嘛。 |
4 puyo Jul 17, 2014 @xcc7624 因为进入如循环后要去取lst中对应item的下标。 第一次取第0个,得到的是0 第二次取第1个,这时候就是从pop之后的列表去取了,是2 ... 第五次得到的就是8,这时候lst表中只有5个数字里。 在第六次的时候,越界了。 |
9 vellow Jul 17, 2014 是不是这样,for循环的index+1不会每次都去查询lst具体有多长,只有遇到终点就结束,所以旧的index会应用到新的lst上? |