What is slicing in Python?

Hi, I want to know What is slicing in Python

Slicing in Python allows you to obtain a part of sequences like strings, lists, and tuples.

Slices can be put on 3rd party objects like NumPy arrays, data frames, and Pandas series.

Slicing allows you to write clean, concise, and readable code.

There are two ways of slicing in Python.

  • slice() Constructor
  • Extending Indexing

More info: String Slicing in Python

Hope it helps!

1 Like