How to fill in a dictionary with key and value from a string?

C W tmrsg11 at gmail.com
Fri Mar 30 16:13:25 EDT 2018


Hello all,

I want to create a dictionary.

The keys are 26 lowercase letters. The values are 26 uppercase letters.

The output should look like:
{'a': 'A', 'b': 'B',...,'z':'Z' }

I know I can use string.ascii_lowercase and string.ascii_uppercase, but how
do I use it exactly?
I have tried the following to create the keys:

myDict = {}
        for e in string.ascii_lowercase:
            myDict[e]=0

But, how to fill in the values? Can I do myDict[0]='A', myDict[1]='B', and
so on?

Thanks!



More information about the Python-list mailing list