len()
Returns the number of bytes/elements.
Syntax
len(text)
Description
Returns the length of the text (in bytes) or the number of elements in a slice. Built-in (no import needed).
Example
Loading editor…
Expected output
7
When to use?
Length check.