python dictionary sort alphabetically code example
Example 1: python sort dictionary alphabetically by key
sortednames=sorted(dictUsers.keys(), key=lambda x:x.lower())
Example 2: sort list alphabetically python
my_list = ['pera', 'apple', 'orange', 'grape']
my_list.sort() # ['apple', 'grape', 'orange', 'pera']