Chrome Extension

Get string length using len() method python

If you want to get the length of a string in Python you can use the len() method of python.
my_str = "The world is beautiful"
print(len(my_str)) #prints 22
Code faster with devsheet chrome extension and increase productivity as a programmer
search code from your favorite search engine instantly.
Install Now

We are getting the length of a given string my_str here using the python len() method. It will return the number of characters that the string contains.

Was this helpful?
Open Code Manager We are hiring