Parsing Python dictionary with multiple objects

Dave Angel davea at davea.name
Wed Oct 15 19:48:22 CEST 2014


Anurag Patibandla <anuragpatibandla7 at gmail.com> Wrote in message:

>     dicts = dict(lists)
>     print dicts
>     print dict[0]
> 
> Print dicts works as expected giving me the combine dictionary values. But when I say dict[0]. I see the error:
> TypeError: 'type' object has no attribute '__getitem__'
> 

Of course. You forgot the s in the name dicts. So you were
 referring to the dict class, not your variable.
-- 
DaveA




More information about the Python-list mailing list