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
2 questions1
Which of the following is true about Nested Dictionaries?
2
What is the most common pitfall when working with Nested Dictionaries?
Answer all questions to submit.