[Zope] Changing key in dictionary
Peter Bengtsson
mail at peterbe.com
Mon May 3 06:07:48 EDT 2004
items['NewKey'] = items['OldKey']; items.pop('OldKey')
Henny van der Linde wrote:
> Hi,
>
> Is there a way to change the key itself of a dictionary.
>
> For instance: items={'the first': [], 'the second': []}
>
> Now at a certain time I want to change the 'the first' in something else. Is
> there a 'rename' method?
>
> Sorry for being ingorant but I couldn't find in the documentation or on the
> net.
>
> I want to mimic the rename function in Zope.
>
> thanks,
>
> Henny
>
>
>
>
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
> .
>
--
Peter Bengtsson, http://www.peterbe.com
More information about the Zope
mailing list