Get Length of Dictionary in Python Tutorial Example

11-Feb-2023

.

Admin

Get Length of Dictionary in Python Tutorial Example

Hi Dev,

Today our leading topic is get length of dictionary in python tutorial example. if you want to see example of python dictionary number of items then you are a right place. you can see python dictionary count items. you will learn python length of dictionary.

There is a way to get length of python dictionary. i will give you very simple example to find size of dictionary python . so you can see the following example codes.

Example :


main.py

myDictionary = {

"one": 10,

"two": 20,

"three": 30,

"four": 40,

"five": 50,

}

# Getting Length of Dictionary

lengthDic = len(myDictionary)

print("Length: ", lengthDic)

Output:

Length: 5

#Python