词云
from wordcloud import WordCloud
from scipy.misc import imread
color_mask = imread("backgroun.jpg")
cloud = WordCloud()
font_path="D:\\SourceHanSerif-Heavy.ttc"
background_color='white'
mask=color_mask
max_words=100
word_cloud = cloud.generate_from_text(get_str_content)
word_cloud.to_file("3.png")
plt.imshow(word_cloud)
plt.axis('off')
plt.show()
from wordcloud import WordCloud
from scipy.misc import imread
color_mask = imread("backgroun.jpg")
cloud = WordCloud()
font_path="D:\\SourceHanSerif-Heavy.ttc"
background_color='white'
mask=color_mask
max_words=100
word_cloud = cloud.generate_from_text(get_str_content)
word_cloud.to_file("3.png")
plt.imshow(word_cloud)
plt.axis('off')
plt.show()

浙公网安备 33010602011771号