Python Tutorials · Python Dictionaries
Nested Dictionaries
Learn all about Nested Dictionaries in this comprehensive tutorial.
5 min read beginner
- •A dictionary can contain dictionaries, this is called nested dictionaries.
- •To access items from a nested dictionary, you use the name of the dictionaries, starting with the outer dictionary:
- •You can loop through a dictionary by using the items() method like this:
Nested Dictionaries
A dictionary can contain dictionaries, this is called nested dictionaries.
python
Or, if you want to add three dictionaries into a new dictionary:
python
Access Items in Nested Dictionaries
To access items from a nested dictionary, you use the name of the dictionaries, starting with the outer dictionary:
python
Loop Through Nested Dictionaries
You can loop through a dictionary by using the items() method like this:
python
Module quiz
Test your knowledge on this module
2 questions