sort keys in dictionary alphabetically python code example
Example 1: python sort dictionary alphabetically by key
sortednames=sorted(dictUsers.keys(), key=lambda x:x.lower())
Example 2: sort dictionary by key
dictionary_items = a_dictionary.items()
sorted_items = sorted(dictionary_items)