Checking if a variable is a dictionary

Guillermo guillermo.listas at googlemail.com
Thu Mar 6 08:06:50 EST 2008


Wow, I think I'm gonna like this forum. Thank you all for the prompt
answers!

>What makes you say you "need" to know this ? Except for a couple corner
>cases, you usually don't need to care about this. If you told us more
>about the actual problem (instead of asking about what you think is the
>solution), we might be of more help...

Good point.

I want to iterate recursively a dictionary whose elements might be
strings or nested tuples or dictionaries and then convert values to a
tagged format according to some rules.

d = {'a':"i'm a", 'b':(1,2,3),'c':{'a':"i'm a",'x':"something",'y':
('a','b','c')}}

I'm just designing the algorithm, but I think Python dictionaries can
hold any kind of sequence?

Regards,

Guillermo



More information about the Python-list mailing list