python slice
自己看吧,是不是比较神奇~
a = 'abcdefg';
print("5->1,step +1:" + a[5:1:1]) #5->1,step +1:
print("5->1,step -1:" + a[5:1:-1]) #5->1,step -1:fedc
print("1->5,step +1:" + a[1:5:1]) #1->5,step +1:bcde
print("1->5,step -1:" + a[1:5:-1]) #1->5,step -1:
a = 'abcdefg';
print("5->1,step +1:" + a[5:1:1]) #5->1,step +1:
print("5->1,step -1:" + a[5:1:-1]) #5->1,step -1:fedc
print("1->5,step +1:" + a[1:5:1]) #1->5,step +1:bcde
print("1->5,step -1:" + a[1:5:-1]) #1->5,step -1: