To find length of String in Python you can use len() function.
Syntax of len() function
len(str)
Where str is the String parameter. This function returns the length of the passed String as an integer, which represents the number of characters in the String.
String length using len() in Python
str = "netjs" print(len(str)) str = "Hello World!" strLen = len(str) print('length of String- ',strLen)
Output
5 length of String- 12
That's all for this topic String Length in Python - len() Function. If you have any doubt or any suggestions to make please drop a comment. Thanks!
>>>Return to Python Tutorial Page
Related Topics
You may also like-