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

前端 未结 7 1552
梦谈多话
梦谈多话 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.

提交回复
热议问题