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

1 Answer 1


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).

  • Yeah, be careful with the return of db.execute. It's a list of dictionary. Commented Jun 26, 2017 at 22:21

You must log in to answer this question.

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