wordcloud is a third-party library that can be used to generate a word cloud for a text.·With the numpy, pillow, and other third-party libraries, wordcloud can be used to analyze the content and generate a word cloud according to the weights of the words.

    In this example, wordcloud is used to design a word cloud named “makeblock keywords”.

    1. import wordcloud
    2. t = ' makeblock AI STEAM mBot Ranger Ultimate Codey halocode mBlock Neuron Laserbox' #Set the content you want to output
    3. w = wordcloud.WordCloud(background_color='white',width = 1000,height = 1000) #Set the format of the word cloud to be generated
    4. w.generate(t) #Select the text to be generated
    5. w.to_file('wordcloud.png') #Set the file name and save the file to a local disk

    The output of the program is as follows.
    wordcloud.png