Python len can be used to return length of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).
Usage
len(s)
Example – len() – string length
s = "Hello" print len(s)
5
Env: Python 2.7.18
Example – len() – list length
s = ["item1", "item2", "item3"] print len(s)
3
Env: Python 2.7.18
Example – len() – dictionary length
s = {"key":"item1", "key2":"item2", "key3":"item3"} print len(s)
3
Env: Python 2.7.18