TypeError: unsubscriptable object
Fredrik Lundh
fredrik at pythonware.com
Tue Nov 29 10:32:18 EST 2005
"enas khalil" <enas_khalil at yahoo.com> wrote:
> i got this error :
> Traceback (most recent call last):
> File "F:\MSC first Chapters\28-11\firstprog1.py", line 53, in -toplevel-
> for cond in word :cfdist[cond].inc[aa['TAG']]
> TypeError: unsubscriptable object
it means that either cfdist, cfdist[cond].inc, or aa is not a subscriptable
object (that it, some of those don't support the [] operator).
my guess is that "inc" is a method, which means that you should use ()
(call method) instead of [] (index):
for cond in word:
cfdist[cond].inc(aa['TAG'])
> also if you please suggest me a good refrence in how to handle different
> types of objects in python as token ,and how i can generate different
> token attributes
I have no idea what you're talking about here. maybe you should
check with an NLTK support forum?
</F>
More information about the Python-list
mailing list