python requests.get encoding
时间: 2023-10-14 12:05:15 浏览: 170
在Python中,当使用requests库的get方法发送一个HTTP GET请求时,可以通过response.encoding属性来设置响应的编码格式。通过设置response.encoding = 'utf-8',可以将响应内容以utf-8编码解析,避免中文乱码问题的发生。 同样,也可以使用response.content.decode("utf-8")的方式将响应内容解码为utf-8格式。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python用requests模板的get函数,xx.encoding是什么意思?](https://blog.csdn.net/weixin_52050936/article/details/113613047)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [python requests库的get()方法使用](https://blog.csdn.net/qq_44728587/article/details/123090304)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [python requests.get带header](https://download.csdn.net/download/weixin_38502239/13739734)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文