# -*-coding:utf-8-*-
import requests
import json
from wordcloud import WordCloud
# url = 'https://www.feixiaohao.com/'
url = 'https://dncapi.bqiapp.com/api/coin/data_list?webp=1'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/65.0.3325.181 Safari/537.36',
'Referer': "http://www.qukuaiwang.com.cn"
}
data = requests.get(url,headers=headers).content
text = json.loads(data)['data']
i =0
for item in text:
if i < 100:
# print(item['name_zh'])
# print(item['symbol'])
name_zh = item['name_zh']
symbol = item['symbol']
with open('crypto-currency.txt','a') as f:
f.write('%s %s '%(name_zh,symbol))
i +=1
with open("crypto-currency.txt" ,encoding="utf-8")as file:
text_1 = file.read()
w = WordCloud(background_color='black',
width=2700,
font_path='/Library/Fonts/Arial Unicode.ttf',
height=1800).generate(text_1)
image=w.to_image()
image.show()
w.to_file("crypto-currency.png")
非小号数字货币名称生成词云
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...