import jieba
import wordcloud
from imageio import imread
from wordcloud import WordCloud
mask=imread('C:\Users\李震宇\Pictures\黑寡妇.jpg')
f=open('C:\Users\少年.txt','r',encoding='gbk')
t=f.read()
f.close()
j=jieba.lcut(t)
txt=' '.join(j)
W=WordCloud(background_color='white',width=800,height=600,
max_words=200, max_font_size=50,mask=mask,
scale=4,font_path='msyh.ttc').generate(txt)
W.to_file('C:\Users\李震宇\Pictures\aaa.png')