Ubuntu的中文是哪种字体?python的词云分析和 三国演义人物出场统计

版权声明:本文为博主原创文章,但部分内容来源自互联网,大家可以随意转载,点赞或留言均可! https://blog.csdn.net/csdn_kou/article/details/83547270

Ubuntu的默认中文是哪种呢?

fc-list :lang=zh 

用这个命令查看出来

NotoSerifCJK-Bold.ttc

为什么要知道这个呢?

来看一块python3代码


import jieba
import wordcloud

f = open("threekingdom.txt","rb")
t = f.read()
f.close()
ls = jieba.lcut(t)
txt = " ".join(ls)
w = wordcloud.WordCloud(    
						font_path = "NotoSerifCJK-Bold.ttc",\
                        width = 1000,height = 700,background_color = "white",\
                       )   

w.generate(txt)
w.to_file("gr.png")

然后发生了什么呢?

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/csdn_kou/article/details/83547270