Patternite Logo

List slicing patterns in Python

1

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

Loading...

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 © 2021

Patternite Logo