如何用替换表名? ,就像这样:
c.execute("CREATE TABLE if not exists ?(id integer,name text)",(tablename,))
c.execute("INSERT INTO ? (id) VALUES(1)",(tablename,))
答案 0 :(得分:0)
尝试一下;
renameTable = "ALTER TABLE old RENAME TO new"
cursor.execute(renameTable)
答案 1 :(得分:0)
感谢大家,我发现我可以这样做:
str = "INSERT INTO %s(id) VALUES (1)"
c.execute(str%s)
表名不能替换为:?