How i create the table mingyan.
CREATE TABLE `mingyan` (
`tag` varchar(10) DEFAULT NULL,
`cont` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
It's said that string format function with {} is more pythonic way than placeholder %.
In my scrapy to write some fields into a table mingyan.
self.cursor.execute("insert into mingyan(tag, cont) values (%s, %s)",(item['tag'],item['cont']))
It works fine in my scrapy,now i replace the placeholder way with string format function.
self.cursor.execute("insert into mingyan(tag, cont) values ({},{})".format(item['tag'],item['cont']))
The scrapy got error info
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax;
Why can't replace placeholder with format function in pymysql?
The item in scrapy doucment.
item meaning in scrapy