Sequence[left:right:step]:
1,若step为正,则表示从索引left开始取,直到索引right为止,但不包括索引right.
如果left >= right,结果为空;
如果left缺省,默认为0;
如果right缺省,默认为len(Sequence);
>>> l = [0,1,2,3,4,5,6,7,8,9]
>>> l[4:4]
[]
>>> l[:4]
[0, 1, 2, 3]
>>> l[4:]
[4, 5, 6, 7, 8, 9]
2,若step为负,则表示从索引left开始取,直到索引right为止,但不包括索引right.
如果left <= right,结果为空;
如果left缺省,默认为len(Sequence)-1;
如果right缺省,默认为-1(好吧,我承认这个-1是我自己安排的);
>>> l[4:4:-1]
[]
>>> l[:4:-1]
[9, 8, 7, 6, 5]
>>> l[4::-1]
[4, 3, 2, 1, 0]
step缺省时为1.