Python: tuple indices must be integers, not str when selecting from mysql table

前端 未结 7 1554
梦谈多话
梦谈多话 2021-01-01 14:08

I have following method that I select all the ids from table and append them to a list and return that list. But when execute this code I end up getting tuple indicies must

相关标签:
7条回答
  • 2021-01-01 15:02

    row is a tuple. When you do row['question_id'], you are trying to access a tuple using a string index which gives you an error.

    0 讨论(0)
提交回复
热议问题