Last modified: February 29, 2020

Python Dictionary: Getting length Using len()

In this tutorial, we going to learn how to get the length of the dictionary by using len() built function

1. What is len() ?

Len() is a Python built function, that returns the number of items of an object.

2. Syntax


3. Example: Getting the length of the dictionary

in this followin example, we'll get length of a dictionary

dictionary1 = {'name':'cat', 'age':'22', 'nationality':'MA'}

#Return the number of items dictionary:



4. Summary

In this article, we've learned how to get the length of a dictionary by using Len() built-function, you can also use this Len() with a tuple, list, and string.