Re: [Tutor] Curious dictionary printing

2012-05-08 Thread Glen Zangirolami
Frankie, Dictionaries do not sort in python because it's much faster to leave it unordered and most of the time it isn't necessary. If you really need ordered dictionaries you can use http://pypi.python.org/pypi/ordereddict for Python <2.7. If you are using python 2.7+ then you can import it from

Re: [Tutor] Curious dictionary printing

2012-05-08 Thread Dave Angel
On 05/08/2012 07:27 AM, Cranky Frankie wrote: > On Mon, May 7, 2012 at 10:31 PM, bob gailer wrote: > >> Asking why does it not do what I want is not IMHO the best way to win >> friends here. > Good morning to you to, Bob. > > I see now that dictionaries in Python act like relational databases in >

Re: [Tutor] Curious dictionary printing

2012-05-08 Thread Cranky Frankie
On Mon, May 7, 2012 at 10:31 PM, bob gailer wrote: > Asking why does it not do what I want is not IMHO the best way to win > friends here. Good morning to you to, Bob. I see now that dictionaries in Python act like relational databases in that there is no inherent ordering. At first, when I sim

Re: [Tutor] Curious dictionary printing

2012-05-07 Thread BRAGA, Bruno
Put it simple, dictionaries do not sort. You can use the dict.keys() to get a list of the dictionary keys, then sort them... there are lots of talks on this, just google a bit, and you will find fancy ways to do key or value sorting. -- *Braga, Bruno* www.brunobraga.net bruno.br...@gmail.com On

Re: [Tutor] Curious dictionary printing

2012-05-07 Thread bob gailer
On 5/7/2012 1:16 PM, Cranky Frankie wrote: In 3.2.2 in IDLE I have this dictionary entry: Namath = {"first_name": "Joe", "last_name": "Namath", "phone": "212-222-",\ "email": "joe.nam...@gmail.com", "stadium": "Shea Stadium"} when I print it: print(Namath) I get: {'phone': '21

Re: [Tutor] Curious dictionary printing

2012-05-07 Thread Mark Lawrence
On 07/05/2012 18:16, Cranky Frankie wrote: In 3.2.2 in IDLE I have this dictionary entry: Namath = {"first_name": "Joe", "last_name": "Namath", "phone": "212-222-",\ "email": "joe.nam...@gmail.com", "stadium": "Shea Stadium"} when I print it: print(Namath) I get: {'phone': '21

Re: [Tutor] Curious dictionary printing

2012-05-07 Thread Walter Prins
Hi, On 7 May 2012 18:16, Cranky Frankie wrote: > In 3.2.2 in IDLE I have this dictionary entry: > > Namath = {"first_name": "Joe", "last_name": "Namath", "phone": " > 212-222-",\ > "email": "joe.nam...@gmail.com", "stadium": "Shea Stadium"} > > Why is it out of order? Python dicti

[Tutor] Curious dictionary printing

2012-05-07 Thread Cranky Frankie
In 3.2.2 in IDLE I have this dictionary entry: Namath = {"first_name": "Joe", "last_name": "Namath", "phone": "212-222-",\ "email": "joe.nam...@gmail.com", "stadium": "Shea Stadium"} when I print it: print(Namath) I get: {'phone': '212-222-', 'first_name': 'Joe', 'last_name':