How to print the key value pairs of a Dictionary in Python

To print the key-value pairs from a Python Dictionary (dict) we can make use of the for loop as follows,

weather_data_dict = {
    "city": "New York",
    "temperature": 23,

for key, value in weather_data_dict.items():
    print(key, ":", value)


city : New York
date : 2023-07-04
temperature : 23
humidity : 56
print the key-value pairs of a Dictionary in Python Example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright ยฉ Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap