An error occurs when pymysql uses% d to pass in parameters

Error:

When using pymysql, an error occurs when using% d to pass parameters in the SQL statement. As shown in the figure:

Error information: typeerror:% d format: a number is required, not str

Cause of problem:

         When a parameter of type int is passed in, it is converted to a parameter of type str. Therefore, the solution is to change% d into% s, pass in int type, and it can still be executed.

Modified:

Data of type int passed in:

Can execute successfully

Solution:

          When data of type int is passed in, the parameter is still passed with% s.

Read More: