How to extract a substring in a String Python
To extract a substring in python we can use the slicing syntax []
by passing the start index and end index as an argument.
Here is an example that extracts the 23
from a given string.
x = 'hel23lo'
# 3 is start index, 5 is end index
extract = x[3:5]
print(extract)
Output:
23