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

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

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

fr open(filePath,'r+')编码

 

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

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

 

3.编码给‘gbk’源码

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

 

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

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

5.最后格式function

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

成功读出汉字了

2020-06-08

相关文章
相关标签/搜索