Archived

python list slicing

An old note — I haven't updated it since I wrote it.
 1names = [0,1,2,3]
 2
 3# print a range from zero, including zero, to one, excluding one
 4print(names[0:1])
 5
 6# print a range from zero, including zero, to ten, excluding ten
 7print(names[0:10])
 8
 9# print a range from 5, including 5, to ten, excluding ten
10print(names[5:10])