我有6000张唱片,我想看看
INSERT
它们指向新表。它们包含单引号和双引号,mysql不能接受我的查询,因为当阻止
'
(单引号)它已关闭并生成语法错误:
sql = "INSERT INTO tr_en_ahmadali(id,sura,aya,aya_text) VALUES({0},{1},{2},'{3}');".format(str(index), str(j[index - 1]) ,str(aya_), str(k[single_aya - 1]))
print(sql)
当我打印查询时,得到以下SQL查询:
INSERT INTO tr_en_ahmadali(id,sura,aya,aya_text) VALUES(34,2,27,'Who, having sealed it, break God's covenant, dividing what He ordained cohered; and those who spread discord in the land will suffer assuredly.');
我的问题是:
如何用python替换每个单引号和双引号?