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.<br clear="all">

<br><span style="font-family:courier new,monospace">--</span><br style="font-family:courier new,monospace"><b style="font-family:courier new,monospace">Braga, Bruno</b><br style="font-family:courier new,monospace"><a style="font-family:courier new,monospace" href="http://www.brunobraga.net" target="_blank">www.brunobraga.net</a><br style="font-family:courier new,monospace">

<a style="font-family:courier new,monospace" href="mailto:bruno.braga@gmail.com" target="_blank">bruno.braga@gmail.com</a><br>
<br><br><div class="gmail_quote">On Tue, May 8, 2012 at 12:31 PM, bob gailer <span dir="ltr">&lt;<a href="mailto:bgailer@gmail.com" target="_blank">bgailer@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On 5/7/2012 1:16 PM, Cranky Frankie wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In 3.2.2 in IDLE I have this dictionary entry:<br>
<br>
Namath = {&quot;first_name&quot;: &quot;Joe&quot;, &quot;last_name&quot;: &quot;Namath&quot;, &quot;phone&quot;: &quot;<a href="tel:212-222-7777" value="+12122227777" target="_blank">212-222-7777</a>&quot;,\<br>
           &quot;email&quot;: &quot;<a href="mailto:joe.namath@gmail.com" target="_blank">joe.namath@gmail.com</a>&quot;, &quot;stadium&quot;: &quot;Shea Stadium&quot;}<br>
<br>
when I print it:<br>
<br>
print(Namath)<br>
<br>
I get:<br>
<br>
{&#39;phone&#39;: &#39;<a href="tel:212-222-7777" value="+12122227777" target="_blank">212-222-7777</a>&#39;, &#39;first_name&#39;: &#39;Joe&#39;, &#39;last_name&#39;: &#39;Namath&#39;,<br>
&#39;email&#39;: &#39;<a href="mailto:joe.namath@gmail.com" target="_blank">joe.namath@gmail.com</a>&#39;, &#39;stadium&#39;: &#39;Shea Stadium&#39;}<br>
<br>
Why is it out of order?<br>
</blockquote>
<br>
May I recommend a different approach to such questions.<br>
<br>
When you get an unexpected (undesired)  result try saying - &quot;Oh I see - that&#39;s how Python does it!&quot;<br>
<br>
I want something different. How can I get it?<br>
<br>
Then try reading the documentation.<br>
<br>
Asking why does it not do what I want is not IMHO the best way to win friends here.<br>
<br>
Taking this steps further<br>
 - what does it mean to be &quot;in order&quot;. To some it is the order in which items are added rather than some collating sequence.<br>
 - Do you want order by key or by value?<br>
 - how would you order {1 : &#39;cat&#39;, &quot;a&quot;: 3, (2,3): True}?<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Bob Gailer<br>
<a href="tel:919-636-4239" value="+19196364239" target="_blank">919-636-4239</a><br>
Chapel Hill NC<br>
<br>
______________________________<u></u>_________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/tutor</a><br>
</font></span></blockquote></div><br>