【Python小随笔】词云
后端:
message = {} list_f = models.Value_A.objects.all() str_list = "" for data in list_f: str_list = str_list +data.title + "," BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) w = wordcloud.WordCloud(width=1000, height=400,max_words=200,background_color='white',font_path='msyh.ttc') w.generate(str_list) w.to_file(BASE_DIR + '/static/ciyun/output1.png') message['ciyun'] = '/static/ciyun/output1.png'
前端:
<div id="ciyun" style="width: 1000px;height:400px;margin-top: 20px;margin-left: 230px"> <img :src="ciyun" style="width: 100%;height: 100%"> </div> el: '#app', data: { ciyun: "" }, this.ciyun = response.data.ciyun
Python全栈(后端、数据分析、脚本、爬虫、EXE客户端) / 前端(WEB,移动,H5) / Linux / SpringBoot / 机器学习

浙公网安备 33010602011771号