Start of main content
Dictionary to list
Python, Dictionary, List · Nov 2, 2020

Converts a dictionary to a list of tuples.
- Use
dict.items()
and list()
to get a list of tuples from the given dictionary.
def dict_to_list(d):
return list(d.items())
d = {'one': 1, 'three': 3, 'five': 5, 'two': 2, 'four': 4}
dict_to_list(d)
More like this

A snippet collection of list helpers and tips for Python 3.6.
Collection · 100 snippets

Combines two or more dictionaries, creating a list of values for each key.
Python, Dictionary · Apr 4, 2021

Retrieves the value of the nested key indicated by the given selector list from a dictionary or list.
Python, Dictionary · Oct 28, 2020

Creates a flat list of all the keys in a flat dictionary.
Python, Dictionary · Nov 2, 2020