Python - Comptez le nombre de clés dans un dictionnaire Python
pythonCopydict1 = {'a':1,'b':2,'c':3}
print(len(dict1.keys()))
Lazy Lizard
pythonCopydict1 = {'a':1,'b':2,'c':3}
print(len(dict1.keys()))
#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