DEV Community

Discussion on: Find substring in string python

Collapse
 
linehammer profile image
linehammer

Python has no substring methods like python substring() or substr(). Instead, you can use slice syntax to get parts of existing strings. Python slicing is a computationally fast way to methodically access parts of your data. The colons (:) in subscript notation make slice notation - which has the arguments, start, stop and step . It follows this template:

Parameters are enclosed in the square brackets.
Parameters are separated by colon.

string[start: end: step]

start - Starting index of string, Default is 0.
end - End index of string which is not inclusive .
step - An integer number specifying the step of the slicing. Default is 1.

net-informations.com/python/basics...

Collapse
 
maxwizardth profile image
oladejo abdullahi

Thank you very kindly for your observation I really appreciate.

Collapse
 
maxwizardth profile image
oladejo abdullahi

However, if you go through the article I am not trying to explain how to extract sub-string from a string but how to search a specific sub-string from a string. You can try to read the article well to get the message. Thanks for your contribution