[Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

Joel Goldstick joel.goldstick at gmail.com
Tue Oct 12 21:53:22 CEST 2010


On Tue, Oct 12, 2010 at 3:39 PM, Sander Sweers <sander.sweers at gmail.com>wrote:

> On 12 October 2010 21:15, Joel Goldstick <joel.goldstick at gmail.com> wrote:
> > When the dictionary is retrieved, its order depends on the hashed values
> > rather than the keys themself.
>
> If (big IF here) you really need an ordered dict you can use the
> OrderedDict from the collections module. However this will only
> guarantee *insertion* order (except for existing keys). Do make sure
> you read pep 372 [1].
>
> Greets
> Sander
>
> [1] http://www.python.org/dev/peps/pep-0372/
> _______________________________________________
>

It seems a common practice to create an ordered list of the keys, then
iterate over the list to operate on the dictionary.

-- 
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101012/3f49c89f/attachment.html>


More information about the Tutor mailing list