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
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
22

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?
0 Comments