newList=[{"link":"https://www.1.com/","ga_tag":"xvideos","image":"http://static.2.mobi/views/images/xvideos.png?x-oss-process=style/120"},{"link":"https://www.3.com/","ga_tag":"xnxx","image":"http://static.4.mobi/views/images/xnxx.png?x-oss-process=style/120"}]
for i in newList:
key_list = []
value_list = []
for key,value in i.items():
key_list.append(key)
value_list.append(value)
INSERT_STRING = "INSERT INTO `%s` (`%s`) VALUE ('%s')" % (tableName, '`,`'.join(key_list),"', '".join(value_list))
转载于:https://my.oschina.net/u/180293/blog/1929047