a[start:end]
# items start through end-1a[start:]
# items start through the rest of the arraya[:end]
# items from the beginning through end-1a[start:end:step]
# start through not past end, by stepa[:]
# a copy of the whole arraylst[::-1]
gives you a reversed copy of the liststart
or end
may be a negative number, which means it counts from the end of the array instead of the beginning. So:a[-1] # last item in the array
a[-2:] # last two items in the array
a[:-2] # everything except the last two items
(source)