I have a dictionary that is not sorted alphabetically that looks like this:
dict = {'zebra': ['file1.txt'], 'alpha': ['file2.txt', 'file3.txt'], ...........}
I want to sort it alphabetically so the output is:
dict ={'alpha': ['file2.txt', 'file3.txt'],'zebra': ['file1.txt'], ...........}
But from what I've seen online so far, their code for ordering it alphabetically loses the properties of a dictionary and either returns a list or it uses OrderedDict which is not the type I want.
A suggestion that made it a list was
sorteddict=sorted(dict.keys(), key=lambda x:x.lower())
But obviously that is not what I'm looking for
Can I somehow use sort on a dictionary while keeping its properties?