python+mysql:在插入语句中使用变量,变量中含有多个引号,和双引号,该如何使用sql语句

数据是一个字典类型:
my_dict={"2017-07" : [ {"origin" : "LJ","price" : 44267,"crawl_date" : "2017-09-01"}]}

item={'name':'万科','city_name':'深圳','location':'龙岗','price':str(my_dict)}

把字典转化为str后,变成了item。

插入语句:
sql2='''insert into house ( name,city_name,location,price) values ('%s','%s','%s','%s')''' %(item['name'], item['city_name'], item['location'], item['price'].encode('utf-8'))

因为price中含有很多引号,{"2017-07" : [ {"origin" : "LJ","price" : 44267,"crawl_date" : "2017-09-01"}]}

所以运行的时候回提示说sql错误,要怎样才能把这些字符显示为字符而非转义字符 ?

引号前面加上斜杠 http://blog.csdn.net/liuxiao723846/article/details/47311157

conn = db.connect(r'D:/E/Eas.db')
print ('Opend database successfully \n')
#conn.row_factory = db.Row
cursor = conn.cursor()
results = cursor.execute("select * from Meter")
rows = cursor.fetchall()
for row in rows:
print(row)#"%s %s %s" % (row["id"], row["No"], row["Name"])
print('\n')
print ('close database successfully')
conn.close()

这是我的查询代码你可以参考下