Quantcast
Channel: Tech Tutorials
Viewing all articles
Browse latest Browse all 862

String Length in Python - len() Function

$
0
0

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

  1. String Slicing in Python
  2. Magic Methods in Python With Examples
  3. Namespace And Variable Scope in Python
  4. Class And Object in Python
  5. Inheritance in Python

You may also like -

  1. How to Convert Array to ArrayList in Java
  2. HashSet Vs LinkedHashSet Vs TreeSet in Java
  3. Access Modifiers in Java
  4. Array in Java
  5. How to Convert Date And Time Between Different Time-Zones in Java
  6. Transaction Management in Spring
  7. Spring Component Scan Example
  8. Installing Hadoop on a Single Node Cluster in Pseudo-Distributed Mode

Viewing all articles
Browse latest Browse all 862

Trending Articles