Patternite Logo

List slicing patterns in Python


A few common list slicing patterns to serve as a quick reference


Python has a clean syntax for extracting a sublist from a list (known as "slicing" a list). The general pattern is list[start_index:stop_index:step].

For a more in-depth overview of list slicing, refer to this excellent blog post.

Profile picture for duncster

Patternite © 2022

Patternite Logo