determining type

Justin Sheehy dworkin at ccs.neu.edu
Thu Jul 13 15:20:02 EDT 2000


"Mike Mikkelsen" <mikk at microbsys.com> writes:

> consider:
> >>>   a = {'item1': 'hello', 'item2':{'subitem1':'goodbye'}}

> Is there a way to tell if 'item2' is a dictionairy, list or simple
> value like 'item1'?

>>> type(a['item1']) == type({})
0
>>> type(a['item2']) == type({})
1

-Justin

 




More information about the Python-list mailing list