filename = "D:\Project_Encyclopedia\img\paper.txt" with open(filename) as f: mytext = f.read()
print(mytext)
from wordcloud import WordCloud wordcloud = WordCloud().generate(mytext)
%pylab inline import matplotlib.pyplot as plt plt.imshow(wordcloud, interpolation=‘bilinear‘) plt.axis("off")
原文:https://www.cnblogs.com/jgg54335/p/14644727.html