What if the string contains single or double quotation marks when Python is inserted into the database?
This article is about how to report an error in single or double quotes in a string when Python is inserted into a database. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The string contains single or double quotation marks when Python is inserted into the database.
You can use pymysql.escape_string () to transform
If type (str_content) is str: str_content = pymysql.escape_string (str_content) python what are the main application areas 1. Cloud computing, typical application OpenStack. 2. WEB front-end development, many large websites are developed by Python. 3. Artificial intelligence applications, which are based on big data's analysis and deep learning, have essentially been unable to leave python. 4. System operation and maintenance project, the standard configuration of automatic operation and maintenance is python+Django/flask. 5. Financial management analysis, quantitative transaction, financial analysis. 6. Big data's analysis.
Thank you for reading! This is the end of the article on "what to do if the string contains single or double quotation marks when Python is inserted into the database". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!