My situation is this:
num = cursor.execute("insert into info (name,age) values(%s,%d)",('lisi',20))
This is the above statement, because the age in the table is int, so you should use% d, but such an error occurs.
At this time, we changed all the formats to% s and quoted 20:
as follows:
num = cursor.execute("insert into info (name,age) values(%s,%s)",('lisi','20'))
All the problems have been solved, and they can be successfully inserted into the database after submission.
So we can always use% s to match in database statements.