Python3 requests post 中文乱码 UnicodeEncodeError: ‘latin-1‘ codec can`t encode characters in ……
程序员文章站
2022-04-28 20:41:46
本文仅供学习交流使用,如侵立删!联系方式及demo下载见文末requests post 中文乱码 UnicodeEncodeError: 'latin-1' ......在使用response.post发送带中文的json数据时,出现如题所示错误,是因为编码问题解决方法: 先编码成bytes(utf-8)格式再解码为latin1import requestsdata = '中文'data = data.encode("utf-8").decode("latin1")requests....
本文仅供学习交流使用,如侵立删!联系方式及demo下载见文末 |
requests post 中文乱码 UnicodeEncodeError: 'latin-1' ......
在使用response.post发送带中文的json数据时,出现如题所示错误,是因为编码问题解决方法: 先编码成bytes(utf-8)格式再解码为latin1
import requests
data = '中文'
data = data.encode("utf-8").decode("latin1&
本文地址:https://blog.csdn.net/qq_38154948/article/details/114004414
推荐阅读
-
UnicodeEncodeError:'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)
-
macOS解决sublime text3运行python3报:UnicodeEncodeError: 'ascii' codec can't encode characters in position
-
Python3 requests post 中文乱码 UnicodeEncodeError: ‘latin-1‘ codec can`t encode characters in ……
-
UnicodeEncodeError:'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)
-
Python3中遇到UnicodeEncodeError: 'ascii' codec can't encode characters in ordinal not in range(128)