[Zope] Changing key in dictionary

robert rottermann robert at redcor.ch
Sun May 2 23:06:14 EDT 2004


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 )
>
>
>  
>
you have to do it as Zope does,
first create a new entry with the new key, and value , and then delete 
the old one.
robert




More information about the Zope mailing list