Articles → Python → Extract Substring In PythonExtract Substring In PythonIn this article, we will discuss how to extract substrings 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])In the above code, the start index is 6 and the end index is 10. From the string, this expression will extract data from indexes 6 to 10.Output Posted By - Karan Gupta Posted On - Friday, February 1, 2019
Your Email Id
Characters remaining 250
Variable_name[start index, end index]
message = "hello gyan"
print("My name is :", message[6:10])