Python sqlite3 string variable in execute

后端 未结 3 1209
小鲜肉
小鲜肉 2020-11-27 18:18

I try to execute this sqlite3 query in Python. I reduced the code to the minimum, sqlite.connect, etc works.

column = \'Pron_1_Pers_Sg\'
goal = \'gender\' 
c         


        
3条回答
  •  执笔经年
    2020-11-27 18:32

    Try this: c.execute("SELECT {idf} FROM Data WHERE {goal}".\ format(idf=column, goal=constrain))

提交回复
热议问题