python抓数据处理

在这里插入图片描述

import wordcloud
file = open(r"D:\PyCharm实例\抓数据\最多收藏.txt",encoding="utf-8")
text = file.read()
wc = wordcloud.WordCloud()
wc.generate(text)
image = wc.to_image()
#stopwords = {" "}
#wc = wordcloud.WordCloud(font_path=r"D:\PyCharm实例\抓数据\STSONG.TTF",stopwords=stopwords)
wc = wordcloud.WordCloud(font_path=r"D:\PyCharm实例\抓数据\STSONG.TTF")
wc.generate(text)
image = wc.to_image()
image.show()

https://blog.csdn.net/weixin_43206161

发布了68 篇原创文章 · 获赞 57 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_43206161/article/details/104201802