I am using Python 3.6. I ran the those lines and got a sorted dictionary by keys.
On Sun, Apr 1, 2018 at 9:38 PM, Chris Angelico <ros...@gmail.com> wrote: > On Mon, Apr 2, 2018 at 11:34 AM, C W <tmrs...@gmail.com> wrote: > > A different but related question: > > > > myDict = dict(zip(string.ascii_lowercase + string.ascii_uppercase, > > string.ascii_lowercase + string.ascii_uppercase)) > >>myDict > > {'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. > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list