sort keys alphabetically python code example
Example 1: python sort dictionary alphabetically by key
sortednames=sorted(dictUsers.keys(), key=lambda x:x.lower())
Example 2: sort the dictionary in python
d = {2: 3, 1: 89, 4: 5, 3: 0}
od = sorted(d.items())
print(od)