⊕
⊖
Contents
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:]
mystring[index:] slices the string from position index until the end.
Examples
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 = 'pythonexamples.org'
index = 6
substring = mystring[index:]
print(substring)
Run Code CopyOutput
examples.org
Summary
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.
Next Topic ⫸ Python string - Iterate over characters
⫷ Previous Topic Python - Get substring between brackets