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