Home / Python Strings / How to Get Length of a String in Python In this example we will show how to get the length of a string using the len() function in Python. Source Code my_str = 'Python' print(len(my_str)) Output: 6