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 1, 2019 Query/Feedback Your Email Id Subject Query/Feedback Characters remaining 250
Variable_name[start index, end index]
message = "hello gyan" print("My name is :", message[6:10])
Query/Feedback