Range value
Specify range
names = ["0","a","two","three","Four","Five","Six","Seven"]Print(Names[1:4])#print one, two, three left including right not included
Fetch from a position to the end
names = ["0","a","two","three","Four","Five","Six","Seven"]Print(names[1:])#print [' One ', ' two ', ' three ', ' four ', ' five ', ' six ', ' seven ']
Pick from a position to the bottom of the number
names = ["0","a","two","three","Four","Five","Six","Seven"]Print(Names[1:-3])#print [' One ', ' two ', ' three ', ' four ']
Jump to the value
names = ["0","a","two","three","Four","Five","Six","Seven"]Print(Names[0::1])#print [' 0 ', ' one ', ' two ', ' three ', ' four ', ' five ', ' six ', ' seven ']//from one to the beginningPrint(Names[0:-1:2])#print [' 0 ', ' two ', ' four ', ' six ']//from head to back to the second, jumping on a one fetchPrint(Names[0::3])#print [' 0 ', ' three ', ' six ']//jump from end to end with two fetching
Countdown value
names = ["0","a","two","three","Four","Five","Six","Seven"]Print(Names[5::-1])#print [' Five ', ' four ', ' three ', ' two ', ' one ', ' 0 ']//5th element to 1th element, upside down one to takePrint(Names[6:2:-2])#print [' Six ', ' four ']//6th element to 2nd element, jump backwards by one and takePrint(Names[-1:0:-2]
Python Array/List