# -*- coding: utf-8 -*- from snownlp import seg from snownlp import SnowNLP import pymysql import configparser import os import re comment = ' [赞] [赞] ' non_img_pattern = re.compile(r'') comment = re.sub(non_img_pattern, '', comment) comment = re.sub(r'\s', '', comment) print(len(comment)) print(comment)