import requests import re import jieba import wordcloud import imageio img = imageio.imread('a.png') f = open('附加.txt', encoding='utf-8') text = f.read() print(text) text_list = jieba.lcut(text) print(text_list) text_str = ' '.join(text_list) print(text_str) wc = wordcloud.WordCloud( width = 500, height = 500, background_color = 'white', mask = img, # stopwords={'疑似',}, font_path = 'msyh.ttc' ) wc.generate(text_str) wc.to_file('词云.png')