LEN
Last updated
Was this helpful?
LEN returns the length of a string, list, or dictionary:
For a string, the number of characters.
For a list, the number of elements.
For a dictionary, the number of key-value pairs.
LEN and COUNT are aliases and are fully interchangeable. By convention, LEN is used with strings and COUNT with lists and dictionaries, but either works for any of the three.
LEN('Hello World') # 11
LEN([1, 2, 3]) # 3
LEN({'a': 1, 'b': 2}) # 2Last updated
Was this helpful?
Was this helpful?
