Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get number of key in dictionary python

#Call len(obj) with a dictionary as obj to count the number 
#of key-value pairs in the dictionary.

a_dictionary = {"a": 1, "b": 2}
print(len(a_dictionary))

OUTPUT:
2
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #number #key #dictionary #python
ADD COMMENT
Topic
Name
6+7 =