Recently, MySQL was used for projects using python.PythonSome of the captured data is stored in MySQL, but there is a problem, because the data captured from the outside has other irregular data such, if you directly call the data insertion method, an error is reported, which is required at this time.
Python MySQL escape.
I started to think that mysqldb does not have a built-in method, and I was planning to filter it myself.AlgorithmLater, I thought that the MySQL module should contain some escape methods, so I kept searching with this belief and found it through the help method and Dir method. It turned out to be: escape_string.
If you want to use the MySQL escape string, you can see the following usage:
Content = mysqldb. escape_string (content)
I have little knowledge. I hope you can help me when you need it. Thank you for your support!
If you are interested in reading the database, you can check it out.Django SQLite database configuration problems
ArticleLink:Http://www.cnpythoner.com/post/163.htmlReprinted and retained. Thank you!