使用PyCharm读取Walden.txt内容时出现编码错误UnicodeDecodeError
使用PyCharm读取Walden.txt内容时出现UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence错误,查了一下是文件编码机制的问题,意思是当内部编码转化成 gbk编码(默认)时出错。例如,错误代码是:path = 'C:/Users/Administrator/Desktop/Walden.txt'with open(path,'r') as tex
原创
2020-06-13 20:36:01 ·
403 阅读 ·
0 评论