python中文词云图代码_python词云图怎么做

编辑main.py,写入如下代码:

import wordcloud

word = wordcloud.WordCloud().generate(

'''

When I do count the clock that tells the time,

And see the brave day sunk in hideous night;

When I behold the violet past prime,

And sable curls all silver'd o'er with white:

When lofty trees I see barren of leaves,

Which erst from heat did canopy the herd,

And summer's green, all girded up in sheaves,

Born on the bier with white and bristly beard;

Then of thy beauty do I question make,

That thou among the wastes of time must go,

Since sweets and beauties do themselves forsake,

And die as fast as they see others grow;

And nothing 'gainst Time's scythe can make defence

Save breed, to brave him when he takes thee hence.

'''

) # 三引号之间的文本,换成你想要的文本

pic = word.to_image()

pic.show()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值