x=[1,2,3,4,5,6]
From before
x[1:]
#[2,3,4,5,6]
From the back
x[:1]
#[1]
From before
x[-1:]
#[6]
From the back
x[:-1]
#[1,2,3,4,5]
From before
x[0:]
#[1,2,3,4,5,6]
From the back
x[:0]
#[]
From before
x[9:]
#[]
From the back
x[:9]
#[1,2,3,4,5,6]
Recommended Posts