<div dir="ltr">Jorg,<div><br></div><div>I'm pretty sure that part of the implementation of the dict type in Python is that there's no guarantee of order.  So if you serialize one you might well get different output because the interpreter has the freedom to store things however it wants for any given situation.</div><div><br></div><div>I haven't used it but there is an OrderedDict class that you can import from the collections package (in Python 2.7)</div><div><br></div><div><a href="https://docs.python.org/2/library/collections.html#collections.OrderedDict">https://docs.python.org/2/library/collections.html#collections.OrderedDict</a><br></div><div><br></div><div>If for some reason you're stuck with Python 2.6 *cough* *Red Hat 6* *cough*  there's a link in that documentation section to a recipe that works in 2.4+</div><div><br></div><div>Hope that helps,</div><div><br></div><div>-Mike</div><div> </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 17, 2016 at 10:37 AM, Jorg Kewisch <span dir="ltr"><<a href="mailto:jorg@bnl.gov" target="_blank">jorg@bnl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(pickle is a python function which allows writing complex data and meta<br>
data to a file and read it back)<br>
<br>
I have a dictionary in a pickle file. I read it with load() and write it<br>
into a second file with dump() without changing anything. The two files<br>
are different, it seems the sequence of the dictionary items differs.<br>
Why is that? And is there a simple way to compare the files?<br>
<br>
jorg<br>
_______________________________________________<br>
Lilug mailing list<br>
<a href="mailto:Lilug@lists.lilug.org">Lilug@lists.lilug.org</a><br>
<a href="http://lists.lilug.org/listinfo.cgi/lilug-lilug.org" rel="noreferrer" target="_blank">http://lists.lilug.org/listinfo.cgi/lilug-lilug.org</a><br>
</blockquote></div><br></div>