Substring from Index to End in Python

Python – Substring from Index to End

To find the substring of a given string from specific index to the end of the string, use the following string slicing notation.


mystring[index:] slices the string from position index until the end.


1. Find substring from specific index to end of string

In the following example, we will take a string in mystring, and get the substring that starts at the index 6, and ends at the end of the given string.

Python Program

mystring = ''
index = 6
substring = mystring[index:]
Run Code Copy



In this tutorial of Python Examples, we learned how to find the substring of a string in Python from given index to end of the string.

Related Tutorials

Code copied to clipboard successfully 👍