UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 0: invalid start byte问题出现

1.上一篇聚类时碰到的问题ui

显示这行读取编码问题:编码

fr open(filePath,'r+')spa

 

2.源码添加了encoding=‘utf-8’code

好吧,人家就是说这个不行(没仔细看报错)utf-8

 

3.编码给‘gbk’源码

TypeError: an integer is required (got type str)class

 

4.终于反应过来要去查查open()require

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

5.最后格式coding

fr open(filePath,'r+',1,'gbk')file

成功读出汉字了

2020-06-08

相关文章
相关标签/搜索