table_name='log'
uname='sc'
upasswd='esg'
str_sql="insert into log values ('%s','%s') "%(uname,upasswd)
cursor.execute(str_sql)
db.commit()
这样写是对的
table_name='log'
uname='sc'
upasswd='esg'
str_sql="insert into '%s' values ('%s','%s') "%(table_name,uname,upasswd)
cursor.execute(str_sql)
db.commit()
这样写就报错了
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''log' values ('sc','esg')' at line 1")
有没有人指点一下