from wordcloud import WordCloud
import matplotlib.pyplot as plt
# Read text from a file
with open('cl.txt', 'r', encoding='utf-8') as file:
text = file.read()
# Generate word cloud
wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text)
# Display the generated word cloud using matplotlib
plt.figure(figsize=(10, 5))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis('off')
plt.show()
#clcoding.com
0 Comments:
Post a Comment