python
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
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?
Similar Posts
- [Python] The get() method on Python dicts and its "default" arg
- The Maximum Length of a Python String Explained
- Get the length of a list in Python
- Get payment method response from strip
- Use separator in print() method of python
- Get character from a string using index Python
- Python - String , Check If Word Is In string