
In this Python lesson, we will focus on Python Iterate Dictionary examples. We will learn how to use iteration with Python Dictionaries. Here, we will focus on for loops and how to us efor loops with dictionaries.
While using loops like below, we get key values like below:
The output of this python iterate dictionary example will be like below:
You can practice below!
You can also check Python Dictionary Access Method

You can also watch the video of this lesson!
See All Dictionary Methods Here → Python Dictionary Methods
So, if you would like to access values of key:value pair, what will you do? In this time we will use the index value between square brackets with the name of the dictionary.
The output of this python iterate dictionary code will be:
We can do another examples with network devices like below:
You can also check Python Dictionary Add Method
We can also use the below codes to get the keys, values and key:value pairs:
Now, let’s do some examples with for loops and these keywords. Firstly, let’s get keys as output.
Now, let’s ee only values of the dictionary.
Laslty, let’s get both keys and values of the dictionary with item keyword.
In this lesson, we have learned how to use for loop with dictionaries. You can increase your examples as python iterate dictionary. With more examples, you will learn this lesson better. We use for loops on Python dictionaries like python lists and python tuples.
Gokhan Kosem is a Network Engineer, Instructor and the Founder of IPCisco.com with 15+ years of experience in Cisco, Nokia, Huawei, Juniper, Linux, Service Provider Networks, Routing and Switching technologies.
He has worked on the backbone networks of major service providers and network vendors including Nortel, Alcatel-Lucent (Nokia) and has extensive hands-on experience with Cisco, Huawei, Juniper and Nokia networking technologies.
He has trained thousands of networking students worldwide through IPCisco.com, Udemy, books, labs, quizzes, and educational content across multiple social media platforms.
IPCisco.com | Best Route to Your Dreams
Leave a Reply