Home / Python Strings / How to Get a Range of Characters in a String in Python In this example we will show how to use the slice syntax to get a range of characters in a string in Python. Source Code my_str = 'Python' print(my_str[1:4]) Output: yth