dictionary

Python: Print Specific key-value pairs of dictionary

In this article, we will discuss different ways to print specific key-value pairs of a dictionary. We can either use indexing or conditions to select few pairs from a dictionary and print them. Table of Contents Print specific key-value pairs from dictionary using indexing. Print first Key-value pair of dictionary. Print last Key-value pair of […]

Python: Print Specific key-value pairs of dictionary Read More »

Python: Pretty print nested dictionaries – dict of dicts

In this article, we will discuss how to print a nested dictionary in a beautiful & readable format. Table of Contents Print a nested dictionary in pretty format using custom function. Print a nested dictionary in pretty format using json module. Print a nested dictionary in pretty format using pandas. A nested dictionary is a

Python: Pretty print nested dictionaries – dict of dicts Read More »

Solved- TypeError: dict_keys object does not support indexing

In this article, we will discuss about the reasons of getting error ‘TypeError: ‘dict_keys’ object does not support indexing’ and how to resolve this error. A little background, In Python, the dictionary class provides functions keys(), values() and items() to fetch keys, values or all items (key-value pairs). But all these functions return view objects,

Solved- TypeError: dict_keys object does not support indexing Read More »

Solved- TypeError: dict_values object does not support indexing

In this article, we will discuss about the reasons of getting error ‘TypeError: ‘dict_values’ object does not support indexing’ and how to resolve this error. A little background, In Python, the dictionary class provides functions keys(), values() and items() to fetch keys, values or all items (key-value pairs). But all these functions returns view objects,

Solved- TypeError: dict_values object does not support indexing Read More »

Scroll to Top