今日学习了python的词云技术 from os import path from wordcloud import WordCloud import matplotlib.pyplot as plt d=path.dirname(__file__) text=open(path.join(d,"data//constitution.txt")).read() # 步骤3-2:设置一张词云图对象 wordcloud = WordCloud(background_color="
简单示例 from matplotlib import pyplot as plt from wordcloud import WordCloud filename = "text.txt" #文本路径 with open(filename,encoding="utf-8") as f: data = f.read() font = r'C:\Windows\Fonts\FZSTK.TTF' wc = WordCloud(font_path=font, # 如果是中