众所周知 ,python对文件读写不友好
在我导入一个新建utf-8 txt文件依然报错之后
最终
data11=open("D:/Downloads/盗墓笔记全集.txt").read().encoding='gbk')
file = open("D:/Downloads/盗墓笔记全集.txt", encoding='gbk')
data=file.read()
可以成功写进data
最后分析数据频率
import jieba.analyse
tag=jieba.analyse.extract_tags(data,15)
print(tag)
最终consel出现
Building prefix dict from the default dictionary ...
Dumping model to file cache C:\Users\Administrator\AppData\Local\Temp\jieba.cache
Loading model cost 2.041 seconds.
Prefix dict has been built succesfully.
['涓涓', '病鏈', '磋交', '涓嶇', '擄細', '娴峰', '嶄細', '轰簡', '绉嶇', '簡寰', '勾杞', '娴锋', '氣滄', '戒汉', '达細']