Extracting a Substring in Python
Author: Newtum
This example explains how to extract a portion of a string, known as a substring, using Python's string slicing notation.
String Slicing Basics
Python's slicing syntax `[start:stop:step]` is a powerful way to get substrings. The `start` index is inclusive, and the `stop` index is exclusive.
Negative Indexing
You can use negative indices to slice from the end of the string.
Slicing with a Step
The optional `step` argument allows you to take every Nth character.