Real Python Tutorials

Sort a Python Dictionary by Value, Key, and More

Sorting a Python Dictionary: Values, Keys, and More

In this tutorial, you'll get the lowdown on sorting Python dictionaries. By the end, you'll be able to sort by key, value, or even nested attributes. But you won't stop there---you'll go on to measure the performance of variations when sorting and compare different key-value data structures.

Aug 10, 2022 intermediate

— FREE Email Series —

🐍 Python Tricks 💌

Python Tricks Dictionary Merge

🔒 No spam. Unsubscribe any time.