Apr-05-2019, 08:38 AM
Hi all,
Im trying to order a Multidimensional dictionary with no success. I get the dict by a function and the result is like this:
I need a helping hand!
Thanks.
Im trying to order a Multidimensional dictionary with no success. I get the dict by a function and the result is like this:
Output:{'Num_Subdir': 11, 'Path': '/root/git/dir1', 'RealSize': '236K', 'Subdir': {'1234': {'Num_Subdir': 10, 'Path': '/root/git/dir1/1234', 'RealSize': '44K', 'Subdir': {'ola000': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola000', 'RealSize': '4,0K', 'Subdir': {}}, 'ola00sd1': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola00sd1', 'RealSize': '4,0K', 'Subdir': {}}, 'ola00sdf': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola00sdf', 'RealSize': '4,0K', 'Subdir': {}}, 'ola1': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola1', 'RealSize': '4,0K', 'Subdir': {}}, 'ola2': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola2', 'RealSize': '4,0K', 'Subdir': {}}, 'ola5': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola5', 'RealSize': '4,0K', 'Subdir': {}}, 'ola6': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola6', 'RealSize': '4,0K', 'Subdir': {}}, 'ola7': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola7', 'RealSize': '4,0K', 'Subdir': {}}, 'ola8': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola8', 'RealSize': '4,0K', 'Subdir': {}}, 'ola9': {'Num_Subdir': 0, 'Path': '/root/git/dir1/1234/ola9', 'RealSize': '4,0K', 'Subdir': {}}}}, 'cece': {'Num_Subdir': 0, 'Path': '/root/git/dir1/cece', 'RealSize': '4,0K', 'Subdir': {}}, 'dir11': {'Num_Subdir': 7, 'Path': '/root/git/dir1/dir11', 'RealSize': '32K', 'Subdir': {'ola1': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola1', 'RealSize': '4,0K', 'Subdir': {}}, 'ola2': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola2', 'RealSize': '4,0K', 'Subdir': {}}, 'ola3': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola3', 'RealSize': '4,0K', 'Subdir': {}}, 'ola5': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola5', 'RealSize': '4,0K', 'Subdir': {}}, 'ola6': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola6', 'RealSize': '4,0K', 'Subdir': {}}, 'ola7': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola7', 'RealSize': '4,0K', 'Subdir': {}}, 'ola9': {'Num_Subdir': 0, 'Path': '/root/git/dir1/dir11/ola9', 'RealSize': '4,0K', 'Subdir': {}}}},Is bigger but, i only put a bit of the code. Well, now i need to order the dictionary, or the output by Num_Subdir of the root directories, so in the output the first one to show should be the directory with more 'Num_Subdir'. Im using python 3.6 and im tried too many options with no succes.. I need a helping hand!
Thanks.
