Python - Length and index
Code Life
By Pierre Marsaa
String Length with len()
In Python, we can find out how many characters are in a string using the len() function. (short for length)
↗️
Loading editor...
↶
↷
What len() counts
The len() function counts EVERYTHING in a string:
- Letters (a, b, c...)
- Numbers (1, 2, 3...)
- Spaces ( )
- Special characters (!, @, #...)
- Punctuation (., ,, ;...)
Verify