问题遇到的现象和发生背景
html_code = """ document.write(''); """
用python想往数据库里面插入一段js代码,但是报错了
问题相关代码,请勿粘贴截图
html_code = """ document.write('<img style="width: 100%;margin: 0 auto;" src="../cartoon/mlxsj/第{}话/'+i+'.jpg" />'); """
运行结果及报错内容
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 'style="width: 100%;margin: 0 auto;" src="../cartoon/mlxsj/第{}话/'+i+'.jpg" />' at line 1')
我的解答思路和尝试过的方法
从报错内容看是我插入语句写错了,我尝试过加入反斜杠但是,没有成功,问下这个要怎么弄
我想要达到的结果
想把这段js代码插入数据库