python里数据库查询带有特殊符号
时间: 2023-08-25 15:15:51 浏览: 165
回答: 在Python中,如果数据库密码中包含特殊字符,可以使用`urllib.parse.quote`方法对密码进行URL编码来解决连接失败的问题。具体做法是将数据库密码中的特殊字符进行编码,例如@符号可以编码为%40。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [flask使用SQLAlchemy数据库连接密码带有特殊符号](https://blog.csdn.net/weixin_37591442/article/details/124842906)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* [〖Python 数据库开发实战 - MySQL篇㉓〗- 单行子查询与多行子查询语法规则](https://blog.csdn.net/weixin_42250835/article/details/126187536)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [python3 插入 mysql 时内容带有特殊字符处理](https://blog.csdn.net/shykevin/article/details/110257499)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文