determining type
Stephen Hansen
stephen at cerebralmaelstrom.com
Thu Jul 13 15:34:48 EDT 2000
import types
if type(a['item2']) == types.DictType:
print a['item2']['subitem1']
--Stephen
Mike Mikkelsen <mikk at microbsys.com> wrote in message
news:396e07fd at news-out...
> 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