Articles → Python → Extract substring in pythonExtract substring in pythonIn this article, we will discuss about how to extract substring in python.Syntax Variable_name[start index, end index]Example Let us consider the following examplemessage = "hello gyan"
print("My name is :", message[6:10])Here the start index is 6 and end index is 10. From the string, this expression will extract data from index 6 to 10.Once you run the above code you will get following outputClick to EnlargePosted By - Karan Gupta Posted On - Friday, February 01, 2019
Your Email Id
Characters remaining 250
Variable_name[start index, end index]
message = "hello gyan"
print("My name is :", message[6:10])