René's URL Explorer Experiment


Title: Sorting a Python Dictionary: Values, Keys, and More – Real Python

Open Graph Title: Sorting a Python Dictionary: Values, Keys, and More – Real Python

Description: 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.

Open Graph Description: 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.

Mail addresses
?subject=Python article for you&body=Sorting a Python Dictionary: Values, Keys, and More on Real Python https://realpython.com/sort-python-dictionary/

Opengraph URL: https://realpython.com/sort-python-dictionary/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "Sorting a Python Dictionary: Values, Keys, and More",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/How-to-Sort-a-Python-Dictionary_Watermarked.3615e3e40965.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/sort-python-dictionary/",
    "lastReviewed": "2024-12-14",
    "author": {
      "@type": "Person",
      "name": "Ian Currie",
      "image": "https://realpython.com/cdn-cgi/image/width=480,height=480,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/5sK42VEQ_-_Copy_-_Copy.b8a1a4a9ca1f.jpeg",
      "url": "https://realpython.com/team/icurrie/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Bartosz Zaczy\u0144ski",
        "image": "https://realpython.com/cdn-cgi/image/width=1694,height=1694,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/coders_lab_2109368.259b1599fbee.jpg",
        "url": "https://realpython.com/team/bzaczynski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Geir Arne Hjelle",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
        "url": "https://realpython.com/team/gahjelle/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Kate Finegan",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/VZxEtUor_400x400.7169c68e3950.jpg",
        "url": "https://realpython.com/team/kfinegan/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2024-12-14T14:00:00+00:00",
  "dateModified": "2024-12-14T14:09:25.210851+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Ian Currie",
    "image": "https://realpython.com/cdn-cgi/image/width=480,height=480,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/5sK42VEQ_-_Copy_-_Copy.b8a1a4a9ca1f.jpeg",
    "url": "https://realpython.com/team/icurrie/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "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.",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "How can you sort a dictionary by its keys in Python?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "

You can sort a dictionary by its keys using the sorted() function with the dictionary’s .items() method, and then convert the result back to a dictionary.

" } }, { "@type": "Question", "name": "What\u2019s the method to sort a dictionary by its values?", "acceptedAnswer": { "@type": "Answer", "text": "

To sort a dictionary by its values, use the sorted() function with the .items() method and specify a key parameter with a lambda function to extract the value.

" } }, { "@type": "Question", "name": "Can you sort a Python dictionary in descending order?", "acceptedAnswer": { "@type": "Answer", "text": "

Yes, you can sort a Python dictionary in descending order by passing reverse=True to the sorted() function.

" } }, { "@type": "Question", "name": "How do you sort a dictionary with non-comparable keys or values?", "acceptedAnswer": { "@type": "Answer", "text": "

When sorting a dictionary with non-comparable keys or values, you need to provide a custom key function that returns a comparable element for each item.

" } }, { "@type": "Question", "name": "Is it possible to sort a dictionary in-place without creating a new one?", "acceptedAnswer": { "@type": "Answer", "text": "

No, sorting a dictionary in-place isn’t possible because dictionaries can’t be reordered. Instead, you need to create a new sorted dictionary.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/How-to-Sort-a-Python-Dictionary_Watermarked.3615e3e40965.jpg
og:imagehttps://files.realpython.com/media/How-to-Sort-a-Python-Dictionary_Watermarked.3615e3e40965.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/sort-python-dictionary/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/sort-python-dictionary/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Fsort-python-dictionary%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/sort-python-dictionary/#toc
Rediscovering Dictionary Order in Pythonhttps://realpython.com/sort-python-dictionary/#rediscovering-dictionary-order-in-python
Understanding What Sorting a Dictionary Really Meanshttps://realpython.com/sort-python-dictionary/#understanding-what-sorting-a-dictionary-really-means
Sorting Dictionaries in Pythonhttps://realpython.com/sort-python-dictionary/#sorting-dictionaries-in-python
Using the sorted() Functionhttps://realpython.com/sort-python-dictionary/#using-the-sorted-function
Getting Keys, Values, or Both From a Dictionaryhttps://realpython.com/sort-python-dictionary/#getting-keys-values-or-both-from-a-dictionary
Understanding How Python Sorts Tupleshttps://realpython.com/sort-python-dictionary/#understanding-how-python-sorts-tuples
Using the key Parameter and Lambda Functionshttps://realpython.com/sort-python-dictionary/#using-the-key-parameter-and-lambda-functions
Selecting a Nested Value With a Sort Keyhttps://realpython.com/sort-python-dictionary/#selecting-a-nested-value-with-a-sort-key
Converting Back to a Dictionaryhttps://realpython.com/sort-python-dictionary/#converting-back-to-a-dictionary
Considering Strategic and Performance Issueshttps://realpython.com/sort-python-dictionary/#considering-strategic-and-performance-issues
Using Special Getter Functions to Increase Performance and Readabilityhttps://realpython.com/sort-python-dictionary/#using-special-getter-functions-to-increase-performance-and-readability
Measuring Performance When Using itemgetter()https://realpython.com/sort-python-dictionary/#measuring-performance-when-using-itemgetter
Judging Whether You Want to Use a Sorted Dictionaryhttps://realpython.com/sort-python-dictionary/#judging-whether-you-want-to-use-a-sorted-dictionary
Comparing the Performance of Different Data Structureshttps://realpython.com/sort-python-dictionary/#comparing-the-performance-of-different-data-structures
Comparing the Performance of Sortinghttps://realpython.com/sort-python-dictionary/#comparing-the-performance-of-sorting
Comparing the Performance of Lookupshttps://realpython.com/sort-python-dictionary/#comparing-the-performance-of-lookups
Conclusionhttps://realpython.com/sort-python-dictionary/#conclusion
Frequently Asked Questionshttps://realpython.com/sort-python-dictionary/#frequently-asked-questions
https://realpython.com/feedback/survey/article/sort-python-dictionary/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/sort-python-dictionary/disliked/?from=article-sidebar
Sorting Dictionaries in Python: Keys, Values, and More 46m · 9 lessons https://realpython.com/courses/sorting-dictionaries-keys-values-more/
Ian Curriehttps://realpython.com/sort-python-dictionary/#author
https://realpython.com/sort-python-dictionary/#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
data-structureshttps://realpython.com/tutorials/data-structures/
stdlibhttps://realpython.com/tutorials/stdlib/
Rediscovering Dictionary Order in Pythonhttps://realpython.com/sort-python-dictionary/#rediscovering-dictionary-order-in-python
Understanding What Sorting a Dictionary Really Meanshttps://realpython.com/sort-python-dictionary/#understanding-what-sorting-a-dictionary-really-means
Sorting Dictionaries in Pythonhttps://realpython.com/sort-python-dictionary/#sorting-dictionaries-in-python
Using the sorted() Functionhttps://realpython.com/sort-python-dictionary/#using-the-sorted-function
Getting Keys, Values, or Both From a Dictionaryhttps://realpython.com/sort-python-dictionary/#getting-keys-values-or-both-from-a-dictionary
Understanding How Python Sorts Tupleshttps://realpython.com/sort-python-dictionary/#understanding-how-python-sorts-tuples
Using the key Parameter and Lambda Functionshttps://realpython.com/sort-python-dictionary/#using-the-key-parameter-and-lambda-functions
Selecting a Nested Value With a Sort Keyhttps://realpython.com/sort-python-dictionary/#selecting-a-nested-value-with-a-sort-key
Converting Back to a Dictionaryhttps://realpython.com/sort-python-dictionary/#converting-back-to-a-dictionary
Considering Strategic and Performance Issueshttps://realpython.com/sort-python-dictionary/#considering-strategic-and-performance-issues
Using Special Getter Functions to Increase Performance and Readabilityhttps://realpython.com/sort-python-dictionary/#using-special-getter-functions-to-increase-performance-and-readability
Measuring Performance When Using itemgetter()https://realpython.com/sort-python-dictionary/#measuring-performance-when-using-itemgetter
Judging Whether You Want to Use a Sorted Dictionaryhttps://realpython.com/sort-python-dictionary/#judging-whether-you-want-to-use-a-sorted-dictionary
Comparing the Performance of Different Data Structureshttps://realpython.com/sort-python-dictionary/#comparing-the-performance-of-different-data-structures
Comparing the Performance of Sortinghttps://realpython.com/sort-python-dictionary/#comparing-the-performance-of-sorting
Comparing the Performance of Lookupshttps://realpython.com/sort-python-dictionary/#comparing-the-performance-of-lookups
Conclusionhttps://realpython.com/sort-python-dictionary/#conclusion
Frequently Asked Questionshttps://realpython.com/sort-python-dictionary/#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
Sorting Dictionaries in Python: Keys, Values, and Morehttps://realpython.com/courses/sorting-dictionaries-keys-values-more/
Click here to download the codehttps://realpython.com/bonus/sort-python-dictionary-code/
https://realpython.com/sort-python-dictionary/#rediscovering-dictionary-order-in-python
hash tablehttps://realpython.com/python-hash-table/
compact dictionaryhttps://docs.python.org/3/whatsnew/3.6.html#whatsnew36-compactdict
insertion orderhttps://mail.python.org/pipermail/python-dev/2016-September/146327.html
guaranteedhttps://realpython.com/python37-new-features/#the-order-of-dictionaries-is-guaranteed
OrderedDicthttps://realpython.com/python-ordereddict/
collections modulehttps://realpython.com/python-collections-module/
later in the tutorialhttps://realpython.com/sort-python-dictionary/#judging-whether-you-want-to-use-a-sorted-dictionary
sequencehttps://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range
sethttps://realpython.com/python-sets/
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#understanding-what-sorting-a-dictionary-really-means
delhttps://realpython.com/python-del-statement/
specific methodhttps://docs.python.org/3/library/collections.html#collections.OrderedDict.move_to_end
later in the tutorialhttps://realpython.com/sort-python-dictionary/#judging-whether-you-want-to-use-a-sorted-dictionary
https://realpython.com/sort-python-dictionary/#sorting-dictionaries-in-python
https://realpython.com/sort-python-dictionary/#using-the-sorted-function
sorted()https://realpython.com/python-sort/
iterablehttps://realpython.com/python-for-loop/#iterables
keyword-only argumentshttps://peps.python.org/pep-3102/
listhttps://realpython.com/python-lists-tuples/#python-lists
callbackhttps://en.wikipedia.org/wiki/Callback_(computer_programming)
laterhttps://realpython.com/sort-python-dictionary/#using-the-key-parameter-and-lambda-functions
stabilityhttps://en.wikipedia.org/wiki/Sorting_algorithm#Stability
.sort()https://docs.python.org/3/library/stdtypes.html#list.sort
reverse=Truehttps://realpython.com/python-reverse-list/
how to use sorted() and .sort()https://realpython.com/python-sort/
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#getting-keys-values-or-both-from-a-dictionary
.items()https://docs.python.org/3/library/stdtypes.html#dict.items
tupleshttps://realpython.com/python-tuple/
dictionary view objecthttps://docs.python.org/3/library/stdtypes.html#dict-views
iterablehttps://realpython.com/iterate-through-dictionary-python/
https://realpython.com/sort-python-dictionary/#understanding-how-python-sorts-tuples
lexicographicallyhttps://en.wikipedia.org/wiki/Lexicographic_order
https://realpython.com/sort-python-dictionary/#using-the-key-parameter-and-lambda-functions
section introducing the sorted() functionhttps://realpython.com/sort-python-dictionary/#using-the-sorted-function
lambda functionhttps://realpython.com/python-lambda/
anonymous functionshttps://en.wikipedia.org/wiki/Anonymous_function
expressionhttps://docs.python.org/3/glossary.html#term-expression
statementshttps://docs.python.org/3/glossary.html#term-statement
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#selecting-a-nested-value-with-a-sort-key
.get()https://realpython.com/python-dicts/#dgetkey-default
https://realpython.com/sort-python-dictionary/#converting-back-to-a-dictionary
dictionary constructorhttps://docs.python.org/3/library/stdtypes.html#dict
dictionary comprehensionhttps://realpython.com/iterate-through-dictionary-python/#using-comprehensions
https://realpython.com/sort-python-dictionary/#considering-strategic-and-performance-issues
Sorted Containershttps://pypi.org/project/sortedcontainers/
SortedDicthttps://grantjenks.com/docs/sortedcontainers/sorteddict.html
timeithttps://realpython.com/python-timer/#estimating-running-time-with-timeit
tutorial on Python timershttps://realpython.com/python-timer/
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#using-special-getter-functions-to-increase-performance-and-readability
itemgetter()https://docs.python.org/3/library/operator.html#operator.itemgetter
https://realpython.com/sort-python-dictionary/#measuring-performance-when-using-itemgetter
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#judging-whether-you-want-to-use-a-sorted-dictionary
language interoperabilityhttps://en.wikipedia.org/wiki/Language_interoperability
HTTP REST APIhttps://realpython.com/api-integration-in-python/
JSONhttps://realpython.com/python-json/
JavaScripthttps://realpython.com/python-vs-javascript/
objecthttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
JSON specificationhttps://www.json.org/json-en.html
OrderedDicthttps://realpython.com/python-ordereddict/
Zen of Pythonhttps://realpython.com/zen-of-python/
https://realpython.com/sort-python-dictionary/#comparing-the-performance-of-different-data-structures
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#comparing-the-performance-of-sorting
namespacehttps://realpython.com/python-namespaces-scope/
premature optimizationhttps://xkcd.com/1445/
https://realpython.com/sort-python-dictionary/#comparing-the-performance-of-lookups
binary search algorithmhttps://realpython.com/binary-search-python/
Grant Jenks’https://grantjenks.com/
sorted dictionaryhttps://grantjenks.com/docs/sortedcontainers/sorteddict.html
Remove adshttps://realpython.com/account/join/
https://realpython.com/sort-python-dictionary/#conclusion
https://realpython.com/sort-python-dictionary/#frequently-asked-questions
Click here to download the codehttps://realpython.com/bonus/sort-python-dictionary-code/
https://realpython.com/feedback/survey/article/sort-python-dictionary/liked/?from=article-footer
https://realpython.com/feedback/survey/article/sort-python-dictionary/disliked/?from=article-footer
Sorting Dictionaries in Python: Keys, Values, and Morehttps://realpython.com/courses/sorting-dictionaries-keys-values-more/
https://realpython.com/team/icurrie/
» More about Ianhttps://realpython.com/team/icurrie/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/bzaczynski/
Bartoszhttps://realpython.com/team/bzaczynski/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/kfinegan/
Katehttps://realpython.com/team/kfinegan/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=sort-python-dictionary
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=sort-python-dictionary
https://realpython.com/feedback/survey/article/sort-python-dictionary/liked/?from=article-comments
https://realpython.com/feedback/survey/article/sort-python-dictionary/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Fsort-python-dictionary%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20Sorting%20a%20Python%20Dictionary%3A%20Values%2C%20Keys%2C%20and%20More&url=https%3A%2F%2Frealpython.com%2Fsort-python-dictionary%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20Sorting%20a%20Python%20Dictionary%3A%20Values%2C%20Keys%2C%20and%20More%20https%3A%2F%2Frealpython.com%2Fsort-python-dictionary%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Fsort-python-dictionary%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
data-structureshttps://realpython.com/tutorials/data-structures/
stdlibhttps://realpython.com/tutorials/stdlib/
Sorting Dictionaries in Python: Keys, Values, and Morehttps://realpython.com/courses/sorting-dictionaries-keys-values-more/?utm_source=realpython&utm_medium=web&utm_campaign=related-course&utm_content=sort-python-dictionary
Dictionaries in Pythonhttps://realpython.com/python-dicts/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=sort-python-dictionary
Python's property(): Add Managed Attributes to Your Classeshttps://realpython.com/python-property/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=sort-python-dictionary
How to Use Python Lambda Functionshttps://realpython.com/python-lambda/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=sort-python-dictionary
Python for Loops: The Pythonic Wayhttps://realpython.com/python-for-loop/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=sort-python-dictionary
Sets in Pythonhttps://realpython.com/python-sets/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=sort-python-dictionary
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fsort-python-dictionary%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fsort-python-dictionary%2F
Sign-Inhttps://realpython.com/account/login/?next=/sort-python-dictionary/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.