[Tutor] Walk a dictionary recursively

Negroup - negroup at gmail.com
Tue Oct 11 09:53:44 CEST 2005


Hi tutors, in my application I found convenient to store all the data
in a data structure based on a dictionary containing a lot of keys,
and each of them host other dictionary with lists and dictionaries
nested inside and so on...

First of all I'd like to know if it is normal to use so complex data
structures in which store data, or if it possible in some way to
organize them using smaller "organizational units".

This is instead the problem I should solve as soon as possible: I
should apply a function, exactly the string's method decode('utf-8'),
to  each key and value of the above descripted dictionary. Consider
that the keys are integers or strings, and if a key is a list, I need
to decode each contained element. Is there a way to walk recursively
the dictionary, or should I write my own walk function?

Thanks in advance,
negroup


More information about the Tutor mailing list