Assuming you are talking about a list, you specify a step in the slice (and start the index). The syntax is list[start:end:step] .
You probably know access to regular lists to get an item, for example. l[2] to get the third element. By providing two numbers and a colon between them, you can specify the range that you want to get from the list. The return value is a different list. For example. l[2:5] gives you the third to sixth element. You can also pass in an additional third number, which determines the step size. The default step size is one, which means only each element (between the start and end index).
Example:
>>> l = range(10) >>> l[::2]
See the listings in the Python tutorial .
If you want to get every n th element of the list (that is, excluding the first element), you need to chop like l[(n-1)::n] .
Example:
>>> l = range(20) >>> l [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Now, every third element will look like this:
>>> l[2::3] [2, 5, 8, 11, 14, 17]
If you want to include the first element, just do l[::n] .