[Tutor] TypeError: unsubscriptable object

Alan Gauld alan.gauld at btinternet.com
Wed Sep 3 22:59:14 CEST 2008


Rilindo Foster wrote:
> The list in 
> question comes in this pair:
> 
> TotalStoreSales = Revenues + "," + Orders
> TotalStoreSales = TotalStoreSales.split(",")

i Rilindo :-)

Why not just

TotalStoreSales = [Revenues, Orders]

> At this point, it has two values, both strings.

Did you try a print statement just to check it is a
list here?

> Then I attempt to do a comparison like so:
> 
>     if (float(TotalStoreSales[0]) > 0):
> TypeError: unsubscriptable object

Normally means the "list" isn't

HTH,

Alan G.



More information about the Tutor mailing list