The study of slice in Python(20170911)
person_infor = [‘yuhanyu’,23,’cs’,’guilin’,’male’] # this is list
print(person_infor[0:2]) # yuhanyu,23
print(person_infor[-3:-1]) # cs,guilin
print(person_infor[-4:]) # 23,cs,guilin,male
print(person_infor[-4:-1]) #23,cs,guilin
person_infor[0:…:-1] should konw where is over
number = list(range(50))
print(number[:10]) # 0 1 2 3 4 5 6 7 8 9
print(number[-10:])# 40 41 42 43 44 45 46 47 48 49
print((0,1,2,3,4,5,6)[:3]) # 0,1,2
print(‘abcdefghjlmn’[:5]) #abcde
print(‘abcdefghijk’[::3]) #adgj