去掉某个文档里面所有的空格和字符串:comment_text=comment_text.replace(' ', '').replace("\t","").replace("\n","").strip()

jieba把中文字符串变成了list,而string.join()把list变成,一个一个加进来:cut_text = ' '.join(jieba.cut(comment_text))

文本变成字符串:comment_text = open("text.txt", 'r').read()

 

相关文章:

  • 2022-02-24
  • 2021-08-16
  • 2021-05-29
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-08
  • 2021-10-29
  • 2021-05-21
  • 2021-12-13
  • 2022-01-05
  • 2021-07-18
相关资源
相似解决方案