As it turns out, I messed up. TotalStoreSales was returning as a
integer, not a list. Which lead me to other issues with the script in
question.
Doh!
Sorry about that and thanks!
On Sep 3, 2008, at 4:37 PM, Kent Johnson wrote:
On Wed, Sep 3, 2008 at 3:44 PM, Rilindo Foster
<[EMAIL PROTECTED]> wrote:
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(",")
These two lines could be just
TotalStoreSales = [Revenues, Orders]
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?
Is anything else happening between these two snippets? Try putting
print type(TotalStoreSales), TotalStoreSales
before the if statement.
Kent
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor