Error writing text to file: ‘charmap’ codec can’t decode byte 0x81 in position 17: character maps to

Error writing text to file: ‘charmap’ codec can’t decode byte 0x81 in position 17: character maps to <undefined>

原因:python程序环境下,当前系统编码格式不支持当前编码,无法解析特殊字符。

解决:在打开文件时使用utf-8编码即可解决。

with open(link_file, 'a', encoding='utf-8') as f:

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注