# -*- coding: utf-8 -*- import wordcloud def Print_picture(): ''' 输出词云图 ''' fb = open('Sort.txt', 'r', encoding='utf-8') txt = fb.read() fb.close() w = wordcloud.WordCloud(font_path='msyhbd.ttc', width=800, height=500, background_color='white') w.generate(txt) w.to_file('词云图.png') print('\n=====图片创建成功!=====\n')