0

I was able to successfully create my index table and it shows the Name and Price correctly. However, it only shows [] for the values of Symbol, Shares, and Total.

Here is my code:

// edited out

I've looked at other questions and I know that execute returns a list, so I should do own[0]['num_of_stocks']. However, when I do this, I get a List Index Out Of Range error. Is there an issue with my execute statements that is causing this? Thanks in advance.

Here is a screenshot of the table: enter image description here

0

After a long look at my code, I realized what the problem was - symbol wasn't actually the symbol, it was a dictionary with the value symbol in it. In the executes, I changed symbol=symbol to symbol=symbol["symbol"]. I also had to change own to own[0]["num_of_stocks"] (I had to change symbol_name and new_cash the same way).

1
  • Yeah, be careful with the return of db.execute. It's a list of dictionary. – Michael Zhang Jun 26 '17 at 22:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .