Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort dictionary by key

def sort_dict(dictionary, rev = True):
    l = list(dictionary.items())
    l.sort(reverse = rev)
    a = [item[1] for item in l]    
    z = ''    
    for x in a:
        z = z + str(x)
    return(z)
Source by kite.com #
 
PREVIOUS NEXT
Tagged: #python #sort #dictionary #key
ADD COMMENT
Topic
Name
9+3 =