mysql database on the solution of Chinese symbols

When using python to operate the mysql database (insert data or update data), there may be errors due to various Chinese symbols, similar to the following situations:

pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near xxxxx)

The error code is 1064. If this error occurs, how can we solve it?

In fact, pymysql has already thought of this situation for everyone, and the solution is as follows:

 If this situation may exist in a certain field, you can use this function to transform it. After the conversion, it is found that the previous problems have really been solved. Pro-testing is useful and recording.

Guess you like

Origin blog.csdn.net/weixin_42575020/article/details/107563999