This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import json | |
import requests | |
import os | |
import time | |
class Pics: | |
def __init__(self): | |
self.header = { | |
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3551.3 Safari/537.36', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wordcloud import WordCloud | |
import matplotlib.pyplot as plt | |
import jieba | |
filename = "cn.txt" | |
#將文檔命名為 cn.txt | |
with open(filename) as f: | |
mytext = f.read() | |
mytext = " ".join(jieba.cut(mytext)) | |
print (mytext) | |
wordcloud = WordCloud(font_path="/Users/xxx/Library/Fonts/思源宋体.otf").generate(mytext) |
NewerOlder