使用模块:
jieba(结巴):切割中文的模块;
wordcloud:
pillow: python3中专门用来处理图像的模块;
numpy:
matplotlib:
1. 处理英文
实现处理英文的词云比较简单
# 1. 切割和处理英文字符,
data = []
with open('/tmp/passwd') as f:
for line in f:
result1 = re.split(r'\s|:|/', line)
# 如果item存在数据并且不是空格或者数字, 则继续进行处理;
result2 = [item for item in result1 if not re.findall(r'\s+|\d+', item) and item]
# print(result2)
data.extend(result2)
# 2)</