python logging模块写入中文,文件乱码的解决方法

久曲健 / 2023-07-23 / 原文

# 创建FileHandler对象
fh = logging.FileHandler('mylog.log',encoding="utf-8",mode="a")