[Tutor] TypeError: unsubscriptable object

Rilindo Foster webmaster at monzell.com
Wed Sep 3 21:44:54 CEST 2008


Hi! Long time reader, first time poster (I think).

I am trying to do a comparison on a particular list item. The list in  
question comes in this pair:

TotalStoreSales = Revenues + "," + Orders
TotalStoreSales = TotalStoreSales.split(",")

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

Then I attempt to do a comparison like so:

if (float(TotalStoreSales[0]) > 0):
     (does stuff)

I know that it is converting into a float - that I verified.

At any event, it keeps returning with this:

Traceback (most recent call last):
   File "./getMivaStoreTransactions.py", line 143, in ?
     TotalSales = TotalSales + getStoreStats(d[0],AllSales)
   File "./getMivaStoreTransactions.py", line 120, in getStoreStats
     if (float(TotalStoreSales[0]) > 0):
TypeError: unsubscriptable object

Maybe I am missing something someplace. Help?

  - Rilindo



More information about the Tutor mailing list