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

Chris Angelico rosuav at
Sun Apr 1 21:38:08 EDT 2018

On Mon, Apr 2, 2018 at 11:34 AM, C W <tmrsg11 at> wrote:
> A different but related question:
> myDict = dict(zip(string.ascii_lowercase + string.ascii_uppercase,
> string.ascii_lowercase + string.ascii_uppercase))
> {'A': 'A', 'B': 'B', 'C': 'C',...,'w': 'w', 'x': 'x', 'y': 'y', 'z': 'z'}
> Why are the keys sorted from upper case to lower case? I asked for lower
> case first, then upper case.

What version of which Python interpreter are you using? Dictionaries
aren't sorted by definition, but sometimes they do retain order.


More information about the Python-list mailing list