Hunter的大杂烩

December 9, 2019

Python 记录log中文报错IOError: [Errno 0] Error

Filed under: 技术话题 — hunter @ 11:56 pm
  1.  WINDOWS下命令行执行报错,可以输入以下2条命令解决
chcp 65001
set PYTHONIOENCODING=utf-8
  1. 写日志时报错,说明变量有些字符是utf8,可以用下面方法解决

logging.error(“some log:” + unicode(input, ‘utf-8’))

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress