Python Forum
Sort MULTIDIMENSIONAL Dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort MULTIDIMENSIONAL Dictionary
#2
Sorting dictionaries is usually making little sense. However, starting from Python 3.7 dictionaries are guaranteed to be in insertion order. So - if you want 'sorted dictionary' then you should build new dictionary by inserting key-value pairs in sorted order.

Still, it seems to me that you actually not wanting to sort dictionary. It seems to me that you actually want sort list (of dictionaries). Meaning that list elements (which happens to be nested dictionaries) must be ordered based on some value in nested dictionary. Is it so? Do you want sort list of dictionaries based on value on first row 'Num_Subdir': 11 in nested dictionary?
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Sort MULTIDIMENSIONAL Dictionary - by mirinda - Apr-05-2019, 08:38 AM
RE: Sort MULTIDIMENSIONAL Dictionary - by perfringo - Apr-05-2019, 10:43 AM
RE: Sort MULTIDIMENSIONAL Dictionary - by perfringo - Apr-05-2019, 12:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 556 Apr-29-2024, 04:38 PM
Last Post: Calab
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,337 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  Counting Element in Multidimensional List quest_ 1 2,138 Nov-25-2020, 10:00 PM
Last Post: quest_
  Choose an element from multidimensional array quest_ 2 2,663 Nov-25-2020, 12:59 AM
Last Post: quest_
  Swap key and value of a dictionary - and sort it Omid 4 2,868 Oct-28-2020, 01:24 PM
Last Post: Omid
  Jelp with a multidimensional loop Formationgrowthhacking 1 1,868 Jan-27-2020, 10:05 PM
Last Post: micseydel
  deleting certain rows from multidimensional list aster 4 14,381 Nov-05-2017, 10:52 PM
Last Post: DeaD_EyE
  Looping through multidimensional array saraeauwhy 0 2,851 Aug-21-2017, 09:12 AM
Last Post: saraeauwhy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020