Error:'cp950' codec can't encode byte 0x8c
in position 403:illegal multibyte sequence
解決方案:encoding='utf-8'
hosts_para_file = open(os.path.join(tmdPath,'hosts'), 'r+', encoding='utf-8')
博客内容讲述了在处理文件时遇到的编码问题,具体表现为'cp950'编码无法处理字节0x8c。解决方案是使用UTF-8编码读取文件,通过修改代码hosts_para_file=open(os.path.join(tmdPath,'hosts'),'r+',encoding='utf-8')来避免非法多字节序列错误。
Error:'cp950' codec can't encode byte 0x8c
in position 403:illegal multibyte sequence
解決方案:encoding='utf-8'
hosts_para_file = open(os.path.join(tmdPath,'hosts'), 'r+', encoding='utf-8')
您可能感兴趣的与本文相关的镜像
Python3.8
Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本
3552
2328
1万+
746
1079
3867

被折叠的 条评论
为什么被折叠?