
Python
chenbang110
学习是最快乐的事
展开
-
UnicodeEncodeError: 'gbk' codec can't encode character '\ubc15' in position
加入一句:sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')原创 2017-09-16 21:11:02 · 925 阅读 · 0 评论 -
Python requests库中文乱码问题
当使用requests库的时候,会出现中文乱码的情况参考代码分析Python requests库中文编码问题 Python HTTP库requests中文页面乱码解决方案!分析根据这两篇文章可知: 分析requests的源代码发现,text返回的是处理过的Unicode型的数据,而使用content返回的是bytes型的原始数据。也就是说,r.content相对转载 2017-10-10 01:01:32 · 3485 阅读 · 1 评论