📜  Python - 计算 Python 字典中的键数 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:05.292000             🧑  作者: Mango

代码示例2
#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