determining type

Brian Steele disposable002 at netscape.net.remove
Thu Jul 13 15:46:41 EDT 2000


>>> a = {'item1': 'hello', 'item2':{'subitem1':'goodbye'}}
>>> b = 'mystring'
>>> c = {'my':'dictionary'}
>>> type(a['item2']) == type(b)
0
>>> type(a['item2']) == type(c)
1


Mike Mikkelsen wrote:
> 
> Hello All,
> 
> Is there a way, programmatically,  to determine if an item in a dictionairy is itself a dictionairy?
> 
> consider:
> >>>   a = {'item1': 'hello', 'item2':{'subitem1':'goodbye'}}
> >>>   print a['item2']['subitem1']
> goodbye
> 
> Is there a way to tell if 'item2' is a dictionairy, list or simple value like 'item1'?
> 
> TIA
> 
> --
> Mike Mikkelsen                   mikk at microbsys.com
> Micro Business Systems         http://microbsys.com
> Fresno Linux Users Group  http://linux.fresno.ca.us
> 
>                  It's all GNU to me!



More information about the Python-list mailing list