I want to create a dictionary which will have all characters in the alphabet as keys. I do that in the following way:
import string
origAlphabetUpCase = string.ascii_uppercase
print origAlphabetUpCase
upCaseDict = dict((el,'') for el in origAlphabetUpCase)
The result I get is as follows:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
{'A': '', 'C': '', 'B': '', 'E': '', 'D': '', 'G': '', 'F': '', 'I': '', 'H': '', 'K': '', 'J': '', 'M': '', 'L': '', 'O': '', 'N': '', 'Q': '', 'P': '', 'S': '', 'R': '', 'U': '', 'T': '', 'W': '', 'V': '', 'Y': '', 'X': '', 'Z': ''}
For some reason the order of keys is not as it's in the initial string. It seems like character pairs were swapped (except A
and Z
).
Any idea how and why that happens?